Constructor: no-argument constructor

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

JAVA

Suppose that one of your clients is the owner of a retail store. This retail store usually sells general merchandise every week. You are supposed to develop a simple program that will simulate the total profit of a week. The program will get the unit price of an article and calculate the actual sales price first. And then it calculates the total anticipated profit of a week. The following formula is used to calculate sales price and total profits:

  • sales price = (unit price x 2) + (unit price x sales tax)
  • profit of an article = (sales price - unit price) x number of the article sold

Your class should be designed as follows:

  • Constructor: no-argument constructor. It initializes all variables. Sales tax is fixed to 5%.
  • greeting method: It prints out greeting messages including version, date produced, and developer.
  • setAll method: It asks a user to input the article name, the unit price of it, expected number of an article to be sold.
  • getSalesprice method: It calculates sales price and returns it.
  • getProfit method: It calculates the profit of an article and returns it.
  • toString method: It prints out the result of the calculation as a table format.

Your program should be developed to test a class and get total profits of a week. And also your test program should ask a user whether or not he/she has more articles to simulate profits.

All data should be displayed as a proper format. It means unit price, sales price, profit, and total profit should be represented as a currency, and sales tax should be represented as a percentage (%).

Expert Solution
steps

Step by step

Solved in 6 steps with 3 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY