Posts

Showing posts from November, 2022

TOPIC 4 EXERCISE 1

Image
Task 1  Write a program that prompts the user to input a number. The program should then output the number and a message saying whether the number is zero, positive or negative. Task 2 Write a program that prompts the user to input three numbers. The program should then output the number in ascending order. Task 3 Write a program that prompts the user to input an integer between 0 and 35. If number less than or equal to 9, the program should the number; otherwise, it should output A for 10, B for 11, C for 12, … , and Z for 35. ( Hint : Use the cast operator (char) for numbers >= 10.) Task 4 The cost of an international call from New York to New Delhi is calculated as follows: connection fee, $1.99; $2.00 for the first three minutes; and $0.45 for each additional minute. Write a program that prompts the user to input a number. The program should then output the number of minutes the call lasted and output the amount due. Format your output with two decimal places. Task 5 Write a...

TOPIC 2 CONVERT TO JAVA CODE

Image
Exercise 1   Exercise 2 Exercise 3 Exercise 4 Exercise 5 Exercise 6 Exercise 7 Exercise 8 Exercise 9 Exercise 10

TOPIC 3 NUMERICAL DATA

Image
 SIMPLE TEST

PROBLEM SOLVING EXERCISE 2

Image
  1. Write the pseudocode and draw a flowchart to convert the length in feet to centimetre.      Hint: 1 foot is 30 centimetres PSEUDOCODE START INPUT LENGTH IN FEET CALCULATE LENGTH IN FEET : 1 FOOT = 30 CENTIMETERS OUTPUT LENGTH IN CENTIMETERS END FLOWCHART 2. Write the pseudocode and draw a flowchart that will read the two sides of a rectangle and calculate its area. PSEUDOCODE START INPUT LENGTH , WIDTH CALCULATE THE AREA = LENGTH * WIDTH OUTPUT AREA OF A RECTANGLE END FLOWCHART 3. Write the pseudocode and draw a flowchart for a program that reads in two numbers from the keyboard and determine and display which number is larger. PSEUDOCODE START INPUT NUMBER 1, NUMBER 2 IF NUMBER 1 > NUMBER 2 PRINT NUMBER 1 “IS LARGER” ELSE PRINT NUMBER 2 “IS LARGER” END IF END FLOWCHART 4. Write the pseudocode and draw a flowchart for a program that reads a number and prints whether it is odd or even. Hint: Use modulus operator %. Any even number ...