import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[] arr = new int[9];
int[] rez = new int[9];
for (int i = 0; i < arr.length; i++) {
System.out.print("Car " + (i + 1) + ": ");
arr[i] = in.nextInt();
}
int x = 0;
for (int i : arr) {
if(i%2 == 0){
rez[x] = i;
x++;
}
}
for (int i : arr) {
if(i%2 != 0){
rez[x] = i;
x++;
}
}
for (int i : rez) {
System.out.print(i + " ");
}
}
}
This is the code i want pseudocode and flowchart of this code.
Consider the abstract class declaration:
class aPolygon
{
protected:
long double * sides, // There are N sides with different lengths
* angles; // There are N angles with different sizes
long int no_of_sides; // The number of sides, N, of this polygon
public: aPolygon(long int _sides = 1);
/* It sets no_of_sides = _sides.*/
virtual void input () = 0; // input the derived polygon
virtual void display () = 0; // display the derived polygon
~aPolygon() {}
};
Write a complete C++ class implementation of the following derived class, aSquare, with the class interface::
class aSquare : public aPolygon
{
public:
aSquare(); /* It creates a square as a unit square */
~aSquare() {}
virtual void input(); /* It inputs the data for the square */
virtual void display(); /* It displays the square: angles, sides, perimeter and area */
long double perimeter(); /* It computes the perimeter of the square */
long double area(); /* It computes the area of the square: */
};
Consider the following program on the link;
https://drive.google.com/file/d/1EELCBZ58M-uxdMDZR8faLLQ45h9jLArE/view?usp=sharing
Now, consider the derived class interface, aTriplet, defined as
template <template T1, class T2, class T3>
class aTriplet : public aPair <T1, T2>
{
private:
T3 obj3; // The 3rd component of the triplet. obj1 and obj2 are inherited from aPair
public: // The get and set data functions
T3 get_obj3(); /* Returns obj3 to any calling environment*/
void set_obj3(T3 value); /* Sets the value of obj3 to value */
// The constructor -- polymorphic
aTriplet(T1 value1 = 0, T2 value2 = 0, T3 value3 = 0);
// It constructs a triple as three components: (value1, value2, value3).
~aTriplet() {} void input(); // It allows the user to enter the three components,
void display();
};
Now, write a complete C++ class implementation of the following constructor and member functions:
a) aTriplet(T1 value1 = 0, T2 value2 = 0, T3 value3 = 0);
b) void input();
c) void display();
What is y after the following switch statement is executed? Rewrite the code using an if-else statement.
x = 3; y = 3;
switch (x + 3) {
case 6: y = 1;
default: y += 1;
}
Write a program to display the days of the week
You are to upload only the .java file
• Do the calculations on Matlab, print it out and then write your answers on the attached answer
sheet.
• Attach your Matlab printout to your answer sheet before you hand in.
1. Find all solutions for each of the following systems of equations (if the system is consistent):
(a) 6.5x − 2y = 7 (b) 3.5x1 + 4.5x2 + 5.5x3 = 11
2x − 0.75y = 1.75 x1 + 4x2 − 7x3 = −16
12x − y = 21 0.5x1 − 0.75x2 + 0.75x3 = 3.5
(c) − 0.75x1 + 0.75x2 = −6 (d) 3.4x1 + 3.4x2 − 15.3x3 = −20.4
2.5x1 + 2x2 − 4.5x3 = 2 0.5x1 + 0.25x2 − 0.75x3 = 1
1.25x1 + 1.25x2 − 2.5x3 = 0 0.75x1 + 0.5x2 − 1.5x3 = 1
Please note: You should use Matlab to write your systems in reduced row echelon form, but have to
interpret the results and give the solution(s) if the system is consistent.
A customer asks for a block of 64 addresses from ISP. If ISP designs the address in classless address scheme, what range of address can be provided to the customer in the block 185.10.X.X/16
The Gaussian distribution also known as the Normal distribution, is given by the following
equation:
𝑦(𝑥) = 𝑒𝑥𝑝 −(𝑥−𝜇)^2/2𝜎^2
where parameter 𝝁 is the mean and 𝝈 the standard deviation.
(i) Write a MATLAB code to create a 1000 point Gaussian distribution of random numbers
having 𝜇 = 0 and 𝜎 = 1. (20)
(ii) Plot this distribution. (10)
(iii) Prove that the full width–half maximum (FWHM), of the above distribution is given by :
FWHM = 2𝜎√2ln 2 (10)
The Gaussian distribution also known as the Normal distribution, is given by the following
equation:
𝑦(𝑥) = 𝑒𝑥𝑝 −(𝑥−𝜇)^2/2𝜎^2
where parameter 𝝁 is the mean and 𝝈 the standard deviation.
(i) Write a MATLAB code to create a 1000 point Gaussian distribution of random numbers
having 𝜇 = 0 and 𝜎 = 1. (20)
(ii) Plot this distribution. (10)
Write a python program that asks the user to type 10 integers and write the number of occurrence of the biggest value