Write a client program that creates an array

Assignment Help Programming Languages
Reference no: EM132075867

Need help with the following java problem:

Suppose you own a computer store that sells two different types of products: desktop computers and laptops. These products can be described using the following attributes: ? Desktops have a processor, RAM, hard drive, and video RAM.

The cost for a desktop1 is calculated like this: base price of $150 + $6.50*(RAM in GB) + $0.15*(hard drive space in GB) + $0.48*(VRAM in MB) ?

Laptops have a processor, RAM, hard drive, and screen size. The cost for a laptop is calculated like this: base price of $300 + $8.00*(RAM in GB) + $0.19*(hard drive space in GB) + $13.83*(screen size in inches)

1. Design and implement the following class hierarchy. All classes should have appropriate constructors.

a. An abstract class Computer that contains as many common elements as possible for both desktops and laptops. It should also contain an abstract getCost() method.

b. Two concrete subclasses of Computer named Desktop and Laptop Both Desktop and Laptop should have toString methods that return information on their type (desktop or laptop), individual components, and cost. Desktop and Laptop should also override the abstract getCost() method with the appropriate calculation.

2. Write a client program that creates an array of at least 5 Computer objects. The array should include both desktops and laptops.

The program should then sort this array by cost (take advantage of the Comparable interface and the sort method for Comparable objects that we discussed in class!), and display the final list of computers sorted by ascending cost.

Note that there should be one array containing all of the computers, not two arrays with the desktops and laptops separately.

Reference no: EM132075867

Questions Cloud

What is the yield to maturity on the bond : The Saleemi Corporation's $1,000 bonds pay 8 percent interest annually and have 15 years until maturity. You can purchase the bond for $1,085.
What is the line efficiency : The cycle time of the line is 30 seconds and the sum of all that tasks required on the line is 10 minutes. What is the line's efficiency?
What is the taxable equivalent yield on a municipal bond : What's the taxable equivalent yield on a municipal bond with a yield to maturity of 4.5 percent for an investor in the 28 percent marginal tax bracket?
Prepare the entry to assign factory labor to production : The gross earnings of the factory workers for Larkin Company during the month of January are $73,000. Prepare the entry to assign factory labor to production
Write a client program that creates an array : Write a client program that creates an array of at least 5 Computer objects. The array should include both desktops and laptops.
Compute the predetermined overhead rate : a) Compute the predetermined overhead rate used during the year in the Preparation andFabrication Departments.
Determine the equivalent units for june for the first proces : a) Determine the equivalent units for June for the first process. b) Compute the costs per equivalent unit for June for the first process.
Record the entries to assign service salaries : Ruiz Engineering Contractors incurred service salaries and wages of $44,000, Record the entries to assign service salaries and wages and to apply overhead
Journalize the entries for the completion of the two jobs : In March, Stinson Company completes Jobs 10 and 11. Journalize the entries for the completion of the two jobs and the sale of Job 10

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd