Exercise 1. (60 pts) Implement the class Product as presented by the following UML diagram: Product code double type: char price : double Producti) getters/setters getfinalPrice) double setNewCode() : void printProduct) void type attribute: M for meat, F for fruit, V for vegetables getFinalPrice(): return the final price which is equal to price - price "0.3 setNewCode(): the New code is the initial code concatenated (using + operator) with the underscore symbol and with the type attribute. Example: if the code is 23 and the type is M then the new code will be 23_M Exercise 2. (40 pts) Write a class to test the Product class as follows: a. Create a product object Prodi by reading its code, type and price from the user. (10 pts) b. Set the user inputs to the attributes of Prodl created. (10 pts) c. Change its code with a new one using the setNewCode) method explained above. (5 pts) d. Find the final price of Prodl. (5 pts) e. Print the details of Prodl (new code, type, final price). (10 pts) a. For the type you should display the whole name, for example if the type is F then we display Fruit
Exercise 1. (60 pts) Implement the class Product as presented by the following UML diagram: Product code double type: char price : double Producti) getters/setters getfinalPrice) double setNewCode() : void printProduct) void type attribute: M for meat, F for fruit, V for vegetables getFinalPrice(): return the final price which is equal to price - price "0.3 setNewCode(): the New code is the initial code concatenated (using + operator) with the underscore symbol and with the type attribute. Example: if the code is 23 and the type is M then the new code will be 23_M Exercise 2. (40 pts) Write a class to test the Product class as follows: a. Create a product object Prodi by reading its code, type and price from the user. (10 pts) b. Set the user inputs to the attributes of Prodl created. (10 pts) c. Change its code with a new one using the setNewCode) method explained above. (5 pts) d. Find the final price of Prodl. (5 pts) e. Print the details of Prodl (new code, type, final price). (10 pts) a. For the type you should display the whole name, for example if the type is F then we display Fruit
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...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY