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

Create a class named Customer that will determine the monthly repayment amount due by a customer for a product bought on credit. The class has five fields: customer name, contact number, product price, number of months and the monthly repayment amount. Write get and set methods for each field, except for the monthly repayment amount field. The set methods must prompt the user to enter the values for the following fields: customer name, contact number, product price and number of months. This class also needs a method to calculate the monthly repayment amount (product price divided by the number of months).


Write the following generic method using selection sort and a comparator: public static <E> void selectionSort(E[] list, Comparator<? super E> comparator) Write a test program that creates an array of 10 GeomtricObjects and invokes this method using GeometricObjectComparator introduced in Listing 20.5 to sort the elements. Display the sorted elements. Use the following statement to create the array: GeometricObjectfi list1 = {new Circle(5), new Rectangle(4, 5), new Circle(5.5), new Rectangle(2.4, 5), 

new Circle(0.5), new Rectangle(4, 65), new Circle(5.4), new 

rectangle(6.6,1), 

new Circle(5.6), new rectangle(5, 4); Also in the same program, write the code that stores six strings by their last character. Use the follwing statement to create the array: String 0 list2 = {"red", "blue", "green", "orange", "yellow", "pink") 



The user must have the ability to search for a product. The user will select menu item
two (2), which will prompt the user to enter a product code. If a valid product is found in
the application, then display the product details to the user. If no valid product is found,
display an error message to the user that the product cannot be located.

You have to design your own Java console application about any valid problem that your application must solve. Your solution can include solving a business problem, a new idea or even a game. Your application must make use of concepts such as arrays, loops, inheritance, constructors and information hiding. Output must be shown in the form of a report using the console.  

In your solution, make use of as many concepts, and components dealt with in this course, but pay special attention to the following learning units: • Learning Unit 1: Advanced arrays. • Learning Unit 2: Introduction to inheritance.


If the user selects to capture a new product, you are required to save all the information
supplied by the user into memory. To achieve this, you may use arrays or array lists.
Sample Capture Product Screenshot
Q.1.4 Special consideration needs to be made for the selection of the product category. Allow
the user to make a selection between the following categories:
• Desktop Computer.
• Laptop.
• Tablet.
• Printer.
• Gaming Console.

The statements below shows the declaration of an array:

 

String[] Municipality ={”Steve Tshwete”, “Nkomazi”, “City of Mbombela”, “Govan Mbeki”};

 

1) Make use of a loop of your choice and write statement(s) that will display all array elements indicating the Municipality’s name as follows:

 

Municipality 1: Steve Tshwete

Municipality 2: Nkomazi

Municipality 3: City of Mbombela

Municipality 4: Govan Mbeki

 

1) Write a statement that will replace array element Nkomazi with White River.

3) What is the array length?

4) Make use of a loop of your choice and write statement(s) that will display all Municipalities, considering effects of question (2), starting with the last Municipality as shown below:

 

Municipality 4: Govan Mbeki

Municipality 3: City of Mbombela

Municipality 2: Nkomazi

Municipality 1: Steve Tshwete


Special consideration needs to be made for the selection of the product category. Allow
the user to make a selection between the following categories:
• Desktop Computer.
• Laptop.
• Tablet.
• Printer.
• Gaming Console.
Extreme IT Products is a local supplier that specialises in the sales of the latest Information
Technology hardware devices. The business has recently opened an outlet in the town you reside
and has hired the software development house you work for to design a Java application to
manage their products.
Your line manager has requested you to develop the application with the following requirements:
Q.1.1 When the application starts, it must display the following menu structure:

Define Exception Handling. Write a java program to create a user defined

exception for the following

a) Create a student class and get the name of the student and 3 subject marks

b) Find the length of the name. If the length > 7 throw LengthException

c) Find the average of marks, if avg < 50 throw FailedException

d) If avg < 75 && avg > 50 throw NotFirstClassException

e) If avg > 75 throw FirstClassException


Create a program that when run with two numbers as CMD arguments, it prints out the difference

and product separated by space[Hint: CMD arguments need to be converted to integers]:

Sample run 1

java lab02_task02 12 3 

Output: 9 36 

Sample run 2

java lab02_task02 2 5

Output: -3 10


LATEST TUTORIALS
APPROVED BY CLIENTS