Create cellphone-flipphone and smartphone

Assignment Help Basic Computer Science
Reference no: EM133233012

Create three classes CellPhone, FlipPhone, and SmartPhone. FlipPhone and SmartPhone should be subclasses of CellPhone.

A cell phone should have attributes for model (String), owner (String), and phone number (int). It should have a default constructor that assigns default values for these attributes.

Write methods for CellPhone named call() and hangup(). The CellPhone hangup method should print "hanging up cell phone". The CellPhone call method should print out that the owner is calling from the phone number (use the variable values for this information).

FlipPhone should override hangup() and print "close phone".

SmartPhone should also override hangup() and print "press end button". SmartPhone should also have attributes for operating system and memory size. It should have a constructor that takes in these as parameters. These variables should be named meaningfully and with reasonable types (I recommend String and int).

Complete the attached PhoneDriver class by adding at least 1 FlipPhone, 2 SmartPhone and 1 CellPhone to the phones ArrayList. (Add at owner names to at least 2 phones. At least one SmartPhone must have operating system and memory size values set.

Run PhoneDriver to see the output.

// Driver class for cell phone assignment

import java.util.ArrayList;

public class PhoneDriver{
public static void main(String[] args) {
ArrayList<CellPhone> phones = new ArrayList<CellPhone>
// add 1 FlipPhone to ArrayList
// add 2 SmartPhone to ArrayList
// add 1 CellPhone to ArrayList
for (CellPhone phone : phones ) {
phone.call();
phone.hangup();
}
}

}

Reference no: EM133233012

Questions Cloud

Risking the destruction of space shuttle : Announced to the press that NASA management was endangering the lives of the crew members and risking the destruction of the space shuttle?
Explain your belief of what business progress means : University of Santo Tomas What areas in business could be studied using descriptive method and How can business research help the consumer and business man?
Why poverty is considered to be deviant : How would the theory explain why poverty is considered to be deviant? Provide real-life examples of how the theory might apply
Advise robert on whether or not a contract exists : Advise Robert on whether or not a Contract exists. Focus on Contract Law relating to Offer and Acceptance as well as the principles of Equity
Create cellphone-flipphone and smartphone : Create three classes CellPhone, FlipPhone, and SmartPhone. FlipPhone and SmartPhone should be subclasses of CellPhone.
Explain the basic concepts of user- generated content : Explain the basic concepts of user- generated content. Explain how graphics, sound, video and rich content can be used in online journalism
Explain the fundamental reason why the courts created : Explain the fundamental reason why the courts created a duty to consult. What is the ultimate goal of the duty to consult?
Explain the process for decision-making and approvals : Explain the process for decision-making and approvals. Identify who monitors progress and how progress is monitored.
Discussing clipping and rasterization concepts : We have been discussing clipping and rasterization concepts in computer graphics. This is described as moving from "geometry to pixel.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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