Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this lab you will work with objects. You can download all files via the provided link or from canvas - Download the Order class documentation.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

this lab you will work with objects. You can download all files via the provided link or from canvas - Download the Order class documentation. - Study the class (Order.java) and familiarize yourself with all details of this class. - Study the list1.txt, list2.txt. - Create a new class called Lab10. - Inside this class, you want to ask the user for a filename, read from the text file line by line, create a new Order object with the data you read from each line, print each Order object, calculate the price of each Order, and add up all prices and print the result as shown below. - You want to use the Order api to generate the following output. - You can download the list1.txt, list2.txt and files here, or from canvas. - You can assume all the data inside the file are always correct, so you don't need to do any expectation handling for reading things from a text file. - Format your output for printing the total sum to look exactly like the sample run. Rules that must be followed: - All methods must be less than or equal to 10 lines. Empty lines, method headers, and lines with only comments and curly braces are not counted. - You can have as many methods as you like. public class Order extends java. lang.0bject Meisam Amjad Lab11 Order Class used for creating Order Objects. Copyright(c) APR 2021 Constructor Summary Constructor and Description Order(int newBarcode, java. lang.String newNane, int unitNums, doul The Order constructor. Method Summary Methods inherited from class java.lang.Object clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait Constructor Detail Order public Order(int newBarcode, java. lang.String newName, int unitNums, double unitPrice) The Order constructor. creates a new Order object with the given info. Parameters: newBarcode - int a barcode newame - String a name for this order unitNums - int the number of units for this order unitPrice - double the price of each unit setName public void setName(java. lang.String newame) Changes the name to the given newName. Paramoters: newame - String The new name. getUnits public int getUnits() Returns the number of units. Returns: int The number of units. setUnits public void setUnits(int unitNuns) Changes the unitNums to the given unitNums. Parameters: unitNums - int The new value for units. getPriceUnit public double getPriceUnit() Returns the value of priceUnit. Returns: double The value of priceUnit setPriceUnit public void setPricellit (double unitPrice) Changes a priceUnit to the given unitPrice. Parameters: unitPrice - double The new value for priceUnit. equals public boolean equals(java. lang.0bject object) Compares two Order objects based on the barcodes. If they have the same barcode it returns true, and false otherwise. Overrides: equals in class java. lang. Object \begin{tabular}{ll|l} 123 Chicken 110.0 & 12342 Pen 10.25 \\ 345 Wine 213.20 & 12343 Book 101.35 \\ 480 Pepsi 120.75 & 12353 Mouse 112.0 \\ 511 rice 17.15 & 12359 Keyboard 143.99 \\ 178 Oreo 32.99 & 12313 Chips 2.89 \\ 186 Coffee 29.85 & 12314 Icecreame 51.30 \\ 102 Icecreame 51.30 & \end{tabular}

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

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

Question Who can establish a Keogh retirement plan?

Answered: 1 week ago