logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Write the Java code to implement the program.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

INSTRUCTIONS TO CANDIDATES

1. This paper consists of six practical questions.

2. Answer only four questions.

3. Do not write on the question paper.

4. Create a folder on the desktop to save all your work.

5. All work must be transferred to a Compact Disk (CD) at the end of the examination.

6. Printout all program codes and output of all answers to questions attempted.

7. Read other instructions on the answer booklet.

 

© 2022 Uganda Business and Technical Examinations Board Turn Over

 Question One

Mbuyu was contracted by L&M Limited to develop a java program that prompts a user to enter any three numbers. The program then displays the product, sum and the maximum of the numbers that the user entered in a tabular format as illustrated below.

Product Sum Maximum

24 9 4

Write the Java code to implement the program. (25 marks)

Question Two

Lwengo Village Bank Limited would like to create a system which inputs each of the members’ principal amounts of money deposited on their accounts for investment at an interest rate determined by the management for a certain period of time. The system calculates the value of investment after the time frame elapses.

Write Java code statements to implement the above program using each of the following selection statements.

(a) For Loop (13 marks)

(b) While Loop (12 marks)

2

Question Three

A certain Technical Institute developed a grading system for modularized curricula as shown in table 1.

Table 1

 

% Marks Grade Letter Grade Point (GP)

80 – 100 A 5.0

75 – 79.9 B+ 4.5

70 – 74.9 B 4.0

65 – 69.9 C+ 3.5

60 – 64.9 C 3.0

55 – 59.9 D+ 2.5

50 – 54.9 D 2.0

0 – 49.9 F 0.0

(a) Write a Java program that displays the student’s Marks, Grade Letter and the Grade Point (GP) when an instructor randomly enters a student’s mark scored in a module.

(25 marks)

Question Four

MK investments wishes to have a computer program that can help employees in Uganda view their NSSF savings at any time. The program should allow an employee to enter their current age, the number of years they have been working and employee basic salary. The program is then expected to display the number of years to retirement and the total NSSF amount accumulated.

Additional information:

Salary is constant and an employee works for 12 months every year.

NSSF is 15% of the basic salary.

Retirement age is 55 years

3 Turn Over

 • Total NSSF is calculated as: yearsOfWork *12*(0.15*basic-salary)

Strictly use a JOptionPane class for both data inputs and outputs.

Write Java code to implement the program described above. (25 marks)

Question Five

The message dialog below was used to display a famous quote.

Write the Java code behind the above GUI (25 marks)

Question Six

(a) Create a class called Invoice that represents an invoice for an item sold at a store. The Invoice class should include four pieces of information as instance variables, as listed below:

1. part number (type String)

2. part description (type String)

3. quantity of the item being purchased (type int)

4. Price per item (double)

(10 marks)

(b) Include a constructor that initializes the four instance variables. Provide a set() and a get() method for each instance variable. (05 marks)

4

(c) Implement a method named getInvoiceAmount() that calculates the invoice amount (multiplies the quantity by the price per item), then returns the amount as a double value. If the quantity is not positive, it should be set to 0. If the price per item is not positive, it should be set to 0.0. Write a test application named InvoiceTest that demonstrates the class Invoice’s capabilities. (10 marks)

 

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

765 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

677 Answers

Hire Me
expert
Husnain SaeedComputer science

861 Answers

Hire Me
expert
Atharva PatilComputer science

635 Answers

Hire Me

Get Free Quote!

271 Experts Online