Using nested loops, write code to produce the following output. (8 marks)
NB: Use only two loops.
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Write a program that accepts a list of integers and computes their sum. The program should allow the user to enter any number of integers but an input of zero should terminate the list. For example if the user enters 2 5 6 12 8 2 0 the sum should be 35. If he/she enters 2 4 5 0 the sum should be 11 and if he enters 5 4 6 0 12 43 2 the sum should 15 i.e. only numbers before zero are summed. The rest are ignored and the program terminated. (5 marks)
Write the pseudocode for the following statement:
The program is to input an examination mark and test it for the award of a grade. The
mark is a whole number between 1 and 100.The program will receive the grade from the
user until the number of entered students is equal to 10 and this should now generate a
report for all the grade entered with the award description. Grades are awarded
according to the following criteria:
>= 80 Distinction
>= 60 Merit
>= 40 Pass
< 40 fail
Write the pseudocode for the following scenario. The final exam marks for 10 students
are 65, 45, 78, 65, 89, 65, 79, 67, 75, and 63. The marks are stored in an array. Find:
• The student with the highest mark.
• The student with the lowest mark.
• The total marks for all the students.
• The overall average.
I'm really fond of even numbers, you know? That's why I'll be letting you make another even number problem yet again. This time, you need to print from a range of two inputted numbers, n1 and n2 (inclusive), all the even numbers from n2 down to n1, in descending order.
Create an Application JFrame contains four JPanel and 12 Buttons that each display a single spell out number.JFrame is assigned a BorderLayout, and each JPanel is assigned either a GRidLayout of FlowLayout and placed in one of the regions(Leaving the north region empty).One or more JButtons are then placed on each JPanel.
Analyze the following Java Program and complete the missing codes:
public class Tut1_17032021_Qb {
public static void main(String[] args){
String name;
String AssessedValueString;
String outputStr;
name = JOptionPane.showInputDialog("Enter Property Name and press ok!");
AssessedValueString = JOptionPane.showInputDialog("Enter Assessed value and press
ok!");
AssessedValue = Double.parseDouble(AssessedValueString);
TaxableAmount = AssessedValue*TaxablePercentage;
PropertyTax = (TaxableAmount/100)*TaxRate;
outputStr = "Property Name: " + name + "\n" + "Assessed Value: R " + AssessedValue + "\n"
+
"Taxable Amount: R " + TaxableAmount + " \n" + "Tax Rate for each R100.00:
" + TaxRate + "
\n" + "Property Tax : R " + PropertyTax;
JOptionPane.showMessageDialog(null, outputStr, "Mafikeng Local Municipality",
JOptionPane.INFORMATION_MESSAGE);
Write a program that accept three numbers,
multiply the first and the third numbers
and divide the results by the second number.
The output for the program should be as follows:
The first number is
The second number is
The third number is
Result is
Write in Java program that requires the user to enter their age. Your program shall then
determine if the individual is old enough to drive (age >=18). If the user is younger that 18, your program should tell them to wait for n years, where n is the number of years until they are 18. If the user is 18 or above, your program shall then require the user to enter their name and
surname in two (2) different variables. Having entered their name and surname, you program shall then print the details of the user. Ensure the following, the name of the user shall always start with a capital letter. All the letters of their surname shall be in capital letters.
A and B shall be displayed regardless of how the user had entered their details
The first line will contain a message prompt to input the value of n.
The second line contains the sum of all odd numbers from 0 to n.