Ask Java Expert


Home >> Java

Assignment- "Television Brands"

Objectives - learn/practice the following new concepts:

• Be able to declare a new class.
• Be able to write a constructor.
• Be able to instantiate an object.
• Be able to use calls to instance methods to access and change the state of an Object.
• Be able to create an array of objects and fill it from a file or the user input.
• Be able to search in or sort an array of objects.

PROJECT OVERVIEW

All manufacturers have the same basic elements in the televisions they produce as well as many options. This project works with a few basic elements that are common to all televisions. Think about a television in general. It has a brand name (i.e. it is made by a specific manufacturer). The television screen has a specific size. It has some basic controls. There is a control to turn the power on and off. There is a control to change the channel. There is also a control for the volume. At any point in time, the television's state can be described by how these controls are set.

INPUT DATA FILE: TVs.csv. The 1st record is a "header record" containing the field-identifiers - skip over this record. The remaining records each contain the following fields in this order:

Manufacturer

ScreenSize

PowerOn

Channel

Volume

This program has 2 separate classes (each in its own .java file). These all contain just non static methods.

1. Controller class:

• MAIN PROGRAM of controllerclass contains the overall controller of the whole program. In the main program of this classcreate an array of objects for Television class called ArrayofTVs with a specific size, Since program does NOT know how many input data records there will be ahead of time, the array sizes should all be "plenty big" (of size MAX_N = 100). HOWEVER, when reading in the data, keep track of counter, and use n (and not array's length) to do any processing.The program should read all the records from TVs.csv file into ArrayofTVs array of objects. The attributes of each record would be stored into the corresponding fields of an object of ArrayofTVs.

• AddNewTelevision method: this method ask the user to input the information about a TV (Manufacturer, ScreenSize, PowerOn, Channel, and Volume) and add it as a new element intoArrayofTVs.

The main method should also call the methods from the television class to change the state of (PowerOn, Channel, or Volume) for some or all objects.

• Sort method:this method sorts the ArrayofTVsbythe screenSize field using either insertion or selection sort. As you sort the screenSizemake the same changes in the other corresponding fields to reflect the sorting.

• Search method:Search for a specific television from the ArrayofTVsaccording to manufacturer attribute, the method return an array of television object for a specificmanufacturer and print all the elements of the returned array of television object into the console screen, otherwise return null if there is nothing matches as a manufacturer to be searched for in the ArrayofTVs.

• PrintToFile method: this method writes the contents of ArrayofTVsafter the changes that you made in the previous stepsinto a .csv file.

2. Television class. Each object that is created from the television class must be able to hold information about that instance of a television in fields. So a television object will have the following attributes:

• manufacturer. The manufacturer attribute will hold the brand name. This cannot change once the television is created, so will be a named constant.

• screenSize. The screenSize attribute will hold the size of the television screen. This cannot change once the television has been created so will be a named constant.

• powerOn. The powerOn attribute will hold the value true if the power is on, and false if the power is off.

• channel. The channel attribute will hold the value of the station that the television is showing.

• volume. The volume attribute will hold a number value representing the loudness (0 being no sound).

These attributes become fields in theTelevision class.

The television object will also be able to control the state of its attributes. These controlsbecome methods in the class.

• Constructormethods that will be used to create an instance of a Television. The class should have a default and parametrized constructors.

• setChannel. The setChannel method will store the desired station in the channel field.

• power. The power method will toggle the power between on and off, changing the value stored in the powerOn field from true to false or from false to true. This can be accomplished by using NOT operator(!). if the Boolean variable powerOn is true, then !powerOn is false and vice versa.

• increaseVolume. The increaseVolume method will increase the value stored in the volume field by 1.

• decreaseVolume. The decreaseVolume method will decrease the value stored in the volume field by 1.

• getChannel. The getChannel method will return the value stored in the channel field.

• getVolume. The getVolume method will return the value stored in the volume field.

• getManufacturer. The getManufacturer method will return the constant value stored in the MANUFACTURER field.

• getScreenSize. The getScreenSize method will return the constant value stored in the SCREEN_SIZE field.

OUTPUT REPORT FILE: OutputReport.csv - looks like the following:

NOTE: it is not necessarily the same contents and ordering sequence, this just shows you the required formatting.

Manufacturer

ScreenSize

PowerOn

Channel

Volume

Samsung

55

TRUE

5

20

Toshiba

55

FALSE

0

0

LG

50

TRUE

20

15

Vizio

50

TRUE

22

30

Samsung

40

TRUE

25

17

Vizio

39

FALSE

0

0

Philips

32

FALSE

0

0

Sony

24

TRUE

12

10

Toshiba

24

TRUE

19

16

Sharp

19

FALSE

0

0

Assignment Submission

• Your project folder should be named la7cs1110_yourlastnameFirstInitial_mmddyy, Replace "yourlastnameFirstInitial" and "mmddyy" appropriately.

• Generate a .zip file that contains all of your files in the above java project folder.

• Submit the .zip file via E-learning.

Java, Programming

  • Category:- Java
  • Reference No.:- M92254585

Have any Question?


Related Questions in Java

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As