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 program that creates a dictionary containing us states

Write a program that creates a dictionary containing the U.S. states as keys and their capitals as values. The program should keep a count of the number.

  Create software to perform advanced geometric calculations

You are hired by the engineering company to create software which performs advanced geometric calculations. Your new boss asked you to create the application

  Write a program that convert number entered in roman numeral

Write a program that converts a number entered in Roman numerals to decimal form. Your program should consist of a class, say romanType.

  Program a maze-type game using assembly language

Project requires you to program a maze-type game using Assembly Language, it is not acceptable to use any other programming language for this project

  Write program to prompt number of rooms in house

Write down the program which prompts for number of rooms in house. Use input, n, to declare array of rectangles dynamically. In loop, input dimensions for n rooms.

  Used to resolve hardware failures

Used to resolve hardware failures by having computers perform computations of a safety critical system and make decisions based on majority vote; in databases, duplicated information

  Write a program that calculate average of an unknown number

Write a program that will calculate and display the average of an unknown number of positive floating point values entered by a user.

  Write program which comprises function to compute calories

Write down program which comprises function calories() that is to accept long integer number total and address of integer variables pizza, chips apples and mustard.

  Explain union command

The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type.

  Calculate the average of the 5 grades passed and display

Calculate the average of the 5 grades passed in and display the average with 1 decimal place and also display the letter grade.

  Ways to ensure that website is easy to navigate

A good practice would be to spread the content out among several pages. What are some ways to ensure that your website is easy to navigate?

  Computing first seven values of fibonacci number sequence

Write a program that uses a loop to compute the first seven values of the Fibonacci number sequence.

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