Create an array of objects and fill it from a file

Assignment Help JAVA Programming
Reference no: EM131445840

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.

Reference no: EM131445840

Questions Cloud

Quality control analytics at toyota : If the specification is such that no washer should be greater than 2.4 millimeters, assuming that the thicknesses are distributed normally, what fraction of the output is expected to be greater than this thickness?
What is its total assets turnover and equity multiplier : Henderson's Hardware has an ROA of 12%, a 3% profit margin, and an ROE of 20%. What is its total assets turnover? What is its equity multiplier?
Why is it important to understand the people side of ea : You were recently promoted to be the team technical lead for your IT operations team. You think the company you work for should adopt an Enterprise Architecture approach, but you don't think you have the authority or influence to make this happen...
How do the studies presented represent behavioral research : What do you find most important, moving, interesting, or surprising about the readings? How do the studies presented represent behavioral research? How do they expand your understanding of the medical/disease model
Create an array of objects and fill it from a file : CS1110- create an array of objects and fill it from a file or the user input. All manufacturers have the same basic elements in the televisions they produce as well as many options.
Problem regarding the request for proposal : Bob's Small Time Grocery has sent a request for proposal (RFP) for designing a simple website for their business. They are unsure what they want, but they do not want to pay for more than 3 pages.
Compute the portfolio beta : Select a portfolio of common stocks in five companies whose stock is traded on the New York Stock Exchange (NYSE). Base your selection of stocks on your own personal willingness to take risks. Look up the beta of each company. Using equal weights, co..
Employee-assistance program function : How does an Employee-Assistance Program function and How would they offer assistance?
What is our cultural attitude toward mental health : What is our cultural attitude toward mental health? How is this visible in our culture? (Think TV, movies, advertisements, products, social media, news media, etc.) Is this a positive or a negative? Why

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

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

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