If the number is only divisible by 3, print "Fizz"
If the number is only divisible by 5, print "Buzz"
If the number is divisible by both 3 and 5, print "FizzBuzz"
If nothing is true in the previous conditions, skip the number
Input two integers in one line. The first inputted integer will be the starting point, and the second one shall serve as the ending point.
Use the power of loops to loop through the starting point until the ending point (inclusive), and print out each number within the range with the corresponding format shown on the sample output. However, skip the printing of statement if the integer is divisible by 4. Tip: Utilize the continue keyword to complete the process
Print out the cube values of the numbers ranging from 1 to 20 (inclusive). However, if the number is divisible by either 3 or 5, do not include them in printing and proceed with the next numbers. Tip: When skipping through special values, make use of the keyword continue and put them inside a conditional statement.
1. You were asked to create a program for a variety stores. The program should:
a. Input the customer name
b. Input the products name and its price. Specifically three products.
c. Get the total price of the 3 products.
d. Input the cash from customer.
e. Output the summary of the sales.
1. You were asked to create a program for variety stores. The program should:
1. Input the customer name.
2. Input the products name and it's price. Specifically three products.
3. Get the total price of the 3 products.
4. Input the cash from customer.
5. Out the summary of the sales.
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner in = new Scanner(System.in); int house = 5; int room = 3; int len = 2; int we = 4; double cost = 6; int areaRoom = len * we; int totalArea = areaRoom * room * house; double totalCost = totalArea * cost; System.out.println("Room area: " + areaRoom); System.out.println("Area of all rooms: " + totalArea); System.out.println("Total price of the construction: " + totalCost); } }
I want pseudocode and flowchart of this code.
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int[] arr = new int[7]; boolean isSorted = true; int buf; for (int i = 0; i < arr.length; i++) { System.out.print("Month " + (i + 1) + ": "); arr[i] = in.nextInt(); } for (int i = 0; i < arr.length; i++){ for (int j = 0; j < arr.length - 1; j++) { if (arr[i] < arr[j]) { buf = arr[i]; arr[i] = arr[j]; arr[j] = buf; } } } for (int i : arr) { System.out.print(i + " "); } } }
This is the code i want pseudocode and flowchart of this code.
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: */
};
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;
}