Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

10) [18 pts] An online shopping site offers a variety of laptops, printers, and monitors. A customer may also buy all in one (Allinone) including

image text in transcribed

10) [18 pts] An online shopping site offers a variety of laptops, printers, and monitors. A customer may also buy all in one (Allinone) including these three. The price of Allinone is the sum of the two highest-priced items in the Allinone, i.e. one item with the lowest price is free. Each item has a name and a price. The four types of the items are represented by the four classes Laptop, Printer, Monitor, and Allinone. All four classes implement the following Item interface. The following diagram shows the relationship between the Interface Item and the classes Laptop, Printer, Monitor, and AllinOne. For example, assume that items sold on the site are as follows. The objects listed under each heading are instances of the class indicated by the heading. - Customers may create Allinone items, each of which includes a laptop, a printer, and a monitor. - The name of the Allinone is composed of the names of the laptop, the printer, and the monitor, in order, each separated by "/" and followed by a space and then "Allinone". - The price of the Allinone is the sum of the two highest-priced items in the Allinone; i.e. one with the lowest price is free. An Allinone consisting of an Apple MacBook Pro, a Canon LBP610, and an Apple ThuderBolt will have the name "Apple MacBook Pro/Canon LBP610/Apple ThuderBolt Allinone" and a price of $3800.00 (the two highest prices are $\$ 2000.00$ and $\$ 1800.00$ ). Similarly, an Allinone consisting of a Dell XPS, an HP Deskjet 5820, and a Dell Curve GT will have the name "Dell XPS/HP Deskjet 5820/Dell Curve GT Allinone" and a price of $\$ 2400.00$ (the two highest prices are $\$ 1500.00$ and $\$ 900.00$ ). Write the class AllinOne that implements the interfaces Item and Comparable. Your implementation must include a constructor that takes three parameters representing a laptop, a printer, and a monitor. The main method is given to test the result. CS.VS.912 10) [18 pts] An online shopping site offers a variety of laptops, printers, and monitors. A customer may also buy all in one (Allinone) including these three. The price of Allinone is the sum of the two highest-priced items in the Allinone, i.e. one item with the lowest price is free. Each item has a name and a price. The four types of the items are represented by the four classes Laptop, Printer, Monitor, and Allinone. All four classes implement the following Item interface. The following diagram shows the relationship between the Interface Item and the classes Laptop, Printer, Monitor, and AllinOne. For example, assume that items sold on the site are as follows. The objects listed under each heading are instances of the class indicated by the heading. - Customers may create Allinone items, each of which includes a laptop, a printer, and a monitor. - The name of the Allinone is composed of the names of the laptop, the printer, and the monitor, in order, each separated by "/" and followed by a space and then "Allinone". - The price of the Allinone is the sum of the two highest-priced items in the Allinone; i.e. one with the lowest price is free. An Allinone consisting of an Apple MacBook Pro, a Canon LBP610, and an Apple ThuderBolt will have the name "Apple MacBook Pro/Canon LBP610/Apple ThuderBolt Allinone" and a price of $3800.00 (the two highest prices are $\$ 2000.00$ and $\$ 1800.00$ ). Similarly, an Allinone consisting of a Dell XPS, an HP Deskjet 5820, and a Dell Curve GT will have the name "Dell XPS/HP Deskjet 5820/Dell Curve GT Allinone" and a price of $\$ 2400.00$ (the two highest prices are $\$ 1500.00$ and $\$ 900.00$ ). Write the class AllinOne that implements the interfaces Item and Comparable. Your implementation must include a constructor that takes three parameters representing a laptop, a printer, and a monitor. The main method is given to test the result. CS.VS.912

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

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

1. Traditional and modern methods of preserving food Articles ?

Answered: 1 week ago

Question

What is sociology and its nature ?

Answered: 1 week ago

Question

What is liquidation ?

Answered: 1 week ago

Question

Explain the different types of Mergers.

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago