Java program Assignment eclipse Java program Assignment eclipse Java program Assignment eclipse Java program Assignment eclipse
project1.docx
Unformatted Attachment Preview
1
Instructions
The goal of this project is to test your ability to use the knowledge of Java that you have
obtained up to this point in the course. The focus of this project is on object-oriented
programming. You also required to use arrays in your solution. See the Possible Object
Design section for one possible valid implementation.
Console
Welcome to the Stock Lister
Enter Stock code: ko
Enter the quantity:
7
Another product? (y/n): y
Enter Stock code: MSFT
Enter the quantity:
8
Another product? (y/n): y
Enter Stock code: AAPL
Enter the quantity:
7
Another product? (y/n): NO
Code
Description
Price
Quantity Total
========= ================================= ========= ========= =========
ko
Coca Cola stock
$57.50
7
$399.0
MSFT
Microsoft Stock
$150.0
8
$1200.0
AAPL
Apple Stock
$260.0
7
$1820.0
Operation





The application prompts the user to enter a stock code.
The application prompts the user to enter the quantity
The application asks the user to continue
The application will compute the total value of each stock
The application will generate the results and display the output for the user (See Console above).
Possible Project Design
1- Product
private
private
private
private
private
class with 5 private instance variables
String stock;
String description;
double price;
double total;
int quantity;
a. Default constructor public Product()
stock = “”;
description = “”;
price = 0;
total=0;
quantity=0;
}
b. A second constructor public Product(String stock, String description, double
price, double total, int quantity)
2- String [] [] ProductArray – An object representing the available stocks within a class
3- A third class to process the input from a user and handle the NumberFormat exceptions.
4- Fourth class will include the main method. Within the main method you can format the output using the
StringBuilder class (Hint: use the pad() method)
Concluding Remarks
You may use your own design of objects for this project, but you are required to write at least 4
classes, and your program should follow object-oriented programming principles. Since this is a
project, I will leave interface design decisions to you. A portion of the grade will be on the
design of the interface. Your program should be easy to use and understand. This is meant to be
AN INDIVIDUAL ASSIGNMENT. Also, taking segments of code from other sources without
citing is plagiarism. The majority of this assignment should be YOUR OWN ORIGINAL
WORK.
Bonus (5 points)
Format the output to generate the subtotal at the end of the “Total” column as shown below:
Welcome to the Stock Lister
Enter Stock code: ko
Enter the quantity:
7
Another product? (y/n): y
Enter Stock code: MSFT
Enter the quantity:
8
Another product? (y/n): y
Enter Stock code: AAPL
Enter the quantity:
7
Another product? (y/n): NO
Code
Description
Price
Quantity Total
========= ================================= ========= ========= =========
ko
Coca Cola stock
$57.50
7
$399.0
MSFT
Microsoft Stock
$150.0
8
$1200.0
AAPL
Apple Stock
$260.0
7
$1820.0
=========
$3419.0

Purchase answer to see full
attachment

Are you having trouble with the above assignment or one similar?

To date, 239 students have ordered this same assignment from us and received 100% original work. We can do the same for you!

We offers 100% original papers that are written from scratch.We also have a team of editors who check each paper for plagiarism before it is sent to you.

Click this “order now” button to see free Cost Breakdown!