Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The java code must be in (Object Oriented programming language) please be clear thanks Problem 2 1. A supermarket is selling some items. It needs

image text in transcribed

The java code must be in (Object Oriented programming language) please be clear

thanks

Problem 2 1. A supermarket is selling some items. It needs to know the profit it is making after selling each day. Help the supermarket owner by building an application to do that. Create a class named "Item" which has the following fields. i. Item number : String ii. Number of items sold: int purchase price : double iv. selling Price : double 2. Write two constructors for the class Item: one without parameters, and another with parameters to fill all its attributes. 3. Write an accessor and a mutator method for each attribute. Make all methods public. 4. Write a toString()" method to display the attributes of the class "Item Testing: 1. Write a Java program "TestSupermarket". In the main method, open the file ItemInventory.txt and read the information about each item: ABC1234 20 35.5 40.5 XYZ5434 30 230 WQE767 250 100 90 TRY1290 100 25 30 2. For each item, an instance of the class "Item" is created and the profit (or loss) is calculated. 3. Write each instance created to an output file, "Items.out" using a PrintWriter Java class. Write the profit or loss beside each item. 4. At the end, write the total profit or loss for the supermarket on this day. 200

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

Step: 3

blur-text-image

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago