Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

12.8 (LAB) Fun With Branching - FINAL

For this project you will write a Java program that will run a simple math quiz. Your program will generate two random integers between 1 and 20 and then ask a series of math questions. Each question will be evaluated as to whether it is the right or wrong answer. In the end a final score should be reported for the user. (See below for how to generate random numbers).

Sample Ouptut This is a sample transcript of what your program should do. Values in the transcript in BOLD show the user inputs. So in this transcript the user inputs 33, Jeremy, 24, -16, and 80 the rest is output from the program.


Create a window (program) that will run as a standalone application. Your program must contain the following components:

 A label

 A button

 A check box

 A text field with a vertical scroll bar




Ben rents a trailer to move his furniture to his new house. The basic cost is R250 per day plus a specific amount that must be entered by him per kilometre travelled. He also has to enter the distance travelled in kilometres.

If Ben travels less than 60 kilometres, an additional surcharge of 3% is payable on the amount due for distance. However, if he uses the trailer for more than 350 kilometres, he receives a discount of 9% on the amount due for distance (Pretorius & Erasmus, 2012:65).

Write a program to calculate and display the amount due.

Hint: use object oriented programming concepts to develop your program.




Ben rents a trailer to move his furniture to his new house. The basic cost is R250 per day plus a specific amount that must be entered by him per kilometre travelled. He also has to enter the distance travelled in kilometres.


If Ben travels less than 60 kilometres, an additional surcharge of 3% is payable on the amount due for distance. However, if he uses the trailer for more than 350 kilometres, he receives a discount of 9% on the amount due for distance (Pretorius & Erasmus, 2012:65).


Write a program to calculate and display the amount due.

Hint: use object oriented programming concepts to develop your program


The user must also have the ability to update specific details of the product. For example, the user must first enter the product code and then confirm whether to update the following product details:

•Update the product warranty.

•Update the product price.

•Update the product stock level


Write a program which takes as input a huge array of numbers. This array is


split into n sub-arrays and n threads apply a bubble sort on each of the n sub-

arrays. Lastly, another thread merges the n sorted sub-arrays into one with


the same size as the original array. Of course, the resulting array should be

sorted.


Define a class named Person that contains the data fields for the first name and last name. Include only a non-default constructor that that initializes the data fields and a method that displays all the information about a Person. b) Define another class named Movie that stores a title, year of production and a director information. Director should be a Person member-object (i.e. use the Person class). Include a non-default constructor and a function to display Movie information. c) Write a program that creates two Movie objects, and displays information about the Movie objects. Save the file as Cinema.jav


Use methods and a loop of your choice to develop a program that can display multiples of 10 until 150 on a single line. For example, the output should be like: 10, 20, 30, 40,…….150.



Ever wondered how change is disbursed to customers in certain stores? In Namibia the following
notes exists 200,100,50,20,10 and following coins: 5, 1, 50c, 10c, 5c. For the sake of this exercises
let us only consider change below 50 see below example:
Sample run 1:
Enter item name: Apples
Enter QTY of Apples: 2
Enter price per item N$: 3.25
Amount tendered N$: 50
Your change is: N$ 43.50
Disbursed as follows: 2 x N$20; 0 x N$10; 0 x N$5; 3 x N$1; 1 x 50c; 0 x 10c; 0 x 5c
[Hint: make use of % and / operators to determine the values needed, see Pg. 113 for more info.]
Create a program that reads the users name and year of birth from input(keyboard), then print out
their name and age in decades(find out the meaning).
Sample run 1: Sample run 2:
Enter your name: Hausiku Enter your name: Johanna
Enter your year of birth:1999 Enter your year of birth:2005
Output: Hello Hausiku, you have lived for 2 Output: Hello Johanna, you have lived for 1
decade(s) decade(s).
LATEST TUTORIALS
APPROVED BY CLIENTS