Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java HW Help!! Under the com package create an ItemSale class. It should have the following class variables: saleld (int), itemName (String), purchase Price (double),

Java HW Help!! image text in transcribed
image text in transcribed
Under the com package create an ItemSale class. It should have the following class variables: saleld (int), itemName (String), purchase Price (double), sellPrice (double) items Sold (int). Create an Item Demo class with a main method. In the main method, create three items. Make only two items have the same itemName. Create the following methods: Create a method called getMostExpensiveltem that passes in three ItemSale objects and returns the name of the most expensive item (Note: if there are two items that have the same price, it will just return the name of the first item). Create a method called getLargestProfititem that passes in three ItemSale objects and returns the name of the item that has the highest profit. To calculate profit, it's (sellPrice-purchasePrice) * itemsSold. (Note: if there are two items that have the same profit, it will just return the name of the first item). Test all methods in the main method. Create a method called getProfit that passes in the name of the item and three ItemSale objects. It will return the total profit for all items matching that itemName. Profit calculation is the same as the calculation in the previous method. Conditional Operators, Objects and Classes! O #com @ ItemSale saleld: int itemName: String purchasePrice: double sellPrice: double itemsSold: int .ItemSale(int, String, double double, int) getSaleld( : int getitemName(): String setItemName(String) : void getPurchasePrice() : double setPurchasePrice(double) : void getSellPrice(): double setSellPrice(double) : void getItems Sold(): int setitemsSold(int) : void com c. Item Demo main(String[]): void getMostExpensiveltem (Item Sale, ItemSale, ItemSale): String .getLargestProfitltem(Item Sale, ItemSale ItemSale): String getProfit(String, ItemSale, ItemSale, ItemSale) : double

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

differentiate the function ( x + 1 ) / ( x ^ 3 + x - 6 )

Answered: 1 week ago