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

A car model class under package:package 3 with the following attributes

1.9.

1.9.1 In a main class, instantiate one object of Type Retail. [2] 1.9.2 Instantiate two objects of each Item [Drink, Detergent, Diary] you can use your own instance variables. [2] 1.9.3 Using the Retail shop method, add these items in the Item stock. [2] 1.9.4 Display the available stock.


1.7 All Items have item name, item size, item price, expiryDate (use LocalDate class for this) . Item fall into the following categories: Drink, Diary, and Detergent.

Drink items have an additional variable a string that shows what type of drink : “fizzy drink” and “fruit drink”.

Dairy has storage Temperature, this is a recommended storage temperature.

Detergent have a string indicating “liquid” or “powder” or “bar”. [5] 1.8 Item has function to view number of days left before expiry. viewExpiry( )

returns an int number of days left before expiry. [2] If this number is less than or equal to 1, print in capital letters that ITEM EXPIRED


A retail shop have functionality to sell. The sell function must take item name, and size as a parameter. Removes the item from the stock and put that Item in the sold list. The sell function also displays the sold item details, name, size, and days before expiry date. [2] If item is not available in the stock a message must be displayed on the screen “no stock”;

1.6 An Items class need to be created in order to implement a complete Retail Shop. All items MUST/ FORCED to have the getPrice() function returns price of an item , setPrice(double price), returns nothing, but set a price of an Item.


1.1 A Retail has name, a List containing Items available in the stock and another List containing sold items. [2] 1.2 A Retail have functionality to view available stock, that prints Class name of item, name of Item, size of item and total number of items that have same name, and size. [5] EXAMPLE

ClassName Item name Size Drink coke 1 Drink coke 2

Total

10; // this show that in the list there are 10 coke that are size of 1

5; // this show that in the list there are 5 coke that are size 2 Sizes in drinks means litres.

Hint: Items are the same if their class name, item name and size are the same.

1.3. A retail Shop has a functionality to add item into the stock list. The add item takes a parameter the Item to be added on stock. [2] 1.4 A retail shop also has a functionality to calculate total sales that returns double sum of money made from all sold items. [2]


Create a project to model students with firstname, lastname, age, gender and student number. Create two constructors, one to be used as default and another to include all attributes. Add a class attribute to keep count of all registered students. Use the class attribute to generate student numbers with the following format 22201XYZ, where XYZ is the current count provided by the class attribute. Implement the respective getters and setters for each attribute. Now given a list of student information create the respective objects and print out their details see samples below, make sure the student class has a toString method.


Write an application for a furniture company; the program determines the price of a table. Ask




the user to choose one for pine, 2 for oak, or three for mahogany. The output is the name of the




wood chosen as well as the price of the table. Pine tables cost $100, oak tables cost $225, and




mahogany tables cost $310. If the user enters an invalid wood code, set the price to zero




Write an application for a lawn-mowing service. The lawn-mowing season lasts 20 weeks. The weekly fee for mowing a lot under 4,000 square feet is R25. The fee for a lot that is 4,000 square feet or more, but under 6,000 square feet, is R35 per week. The fee for a lot that is 6,000 square feet or over is R50 per week. Prompt the user for the length and width of a lawn USING JOPTIONPANE, and then display the weekly mowing fee USING JOPTIONPANE , as well as the 20-week seasonal fee. Save the file as Lawn.java.



Marks allocation



1. The use of class and object - 10



2. The use of JOption for input -10



3. The use of JOption for output-10



4. correct out -10

Write an application that prompts the user for a checking account balance and a savings account balance (The balance of these two account should be generated automatically by the program within this range 1 to 100 rand and stored into an array ). Display the message “Checking account balance is low” if the checking account balance is less than R10. Display the message “Savings account balance is low” if the savings account balance is less than R100. Save the file as Balance.java.

Marks allocation 

1. Use of a random function- 5

2. use of an array to store the generated balance -5

3. use of an if statement -5

4 . Display of correct output -10

Using the provided recording and your knowledge from programming 1. Create a program in java that takes in an input from the user and checks whether it’s a number or a word. In case a number is entered the program should print the number to the power 3 and if a word is entered your program should split that word into 2.



Sample Run 1



Enter a number or word: 7



Output 1:



7 to the power 3= 343



Sample Run 2



Enter a number or word: NAMIBIA



Output 2:



The word split in half is : NAMI and BIA

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS