Java identifiers and variable class, JAVA Programming

Assignment Help:

1. Which of the following are not valid Java identifiers, and why?

(a) wolVes

(b) United(there is only one)

(c) 87

(d) 5 3

(e) Real ale

(f) isFound?by

2. A class Television has the following fields:

private TelevisionManufacturer supplier;

private String code

private int screenSize; // in inches

private String type; // e.g. plasma screen

Assume that the class TelevisionManufacturer is available and that this class contains an equals method.

(a) Define a class variable, totalTVs, whose purpose is to keep track of the total number of Television objects constructed during execution of a program that uses the Television class.

(b) Declare a default constructor for this class.

(c) Declare a constructor for this class which has a formal parameter corresponding to each field.

(d) Declare an accessor method called getScreenSize whose purpose is to return the value of the screenSize field of this Television.

(e) Declare a mutator method that sets the type of this Television to a given value.

(f) Declare a method to determine whether or not this Television has been supplied by a given manufacturer.

Lab work

1. An electronics company needs to implement a simple stock control system. You are required to write a Java application which contains a class called StockItem together with a main method class called StockDemo. Information for each type of stock item consists of:

1.  inventory identifier (e.g. A654Y);

2.  quantity in stock (e.g. 350);

3.  demand rate (quantity removed from stock each working day, assumed constant, e.g. 50);

4.  re-order quantity (the size of an ordered batch of items, assumed constant, e.g 1000);

5.  lead-time (number of working days delay between placing and receiving an order for a batch, e.g. 5).

The class StockItem should include fields for each of the above data items and should also include each of the following:

1.  a default constructor that sets all fields to null or zero as appropriate;

2.  a constructor with arguments for all fields;

3.  set methods for all fields;

4.  accessor methods for each of the fields;

5.  a method to update the stock quantity when a batch is received;


Related Discussions:- Java identifiers and variable class

Explain the phase compile- java program development, Explain the phase Comp...

Explain the phase Compile- Java Program Development In Phase 2, programmer gives the command javac to compile the program. Java compiler translates the java program into byte

Write a java console application, You are to write a Java console applicati...

You are to write a Java console application, following the Software Life Cycle model, which will read personnel records from a text file and store them in a data structure.  One li

Explain the purpose of the access token, Question: a) Authentication r...

Question: a) Authentication relies on standards and protocols that are used to confirm the identity of a user or object. Windows Server 2003 supports several types of network

Algorithms, COMPSCI220S2C2012 Assignment 1 due 8 August 8:30 pm This assign...

COMPSCI220S2C2012 Assignment 1 due 8 August 8:30 pm This assignment introduces you to an example of applied algorithm analysis and shows you why, sometimes, compromises in an algor

Development of an android app urgent, Development of an Android app urgent ...

Development of an Android app urgent Project Description: I am searching for some good android developer who has depth in knowledge of making an app. I am focusing on a certa

Write a bouncing ball game, Write a bouncing ball video game. The game is s...

Write a bouncing ball video game. The game is similar to the one described and depicted in Figure of the text book. The balls bounces within the screen where the two horizontal wal

A one page website where a user can input the information, A one page websi...

A one page website where a user can input the information including Company Name, Title, Activity, R/S, I also need the user to select the start date, end date, and check poi

Big m method, i''ve done an application that calculates simplex methods i n...

i''ve done an application that calculates simplex methods i need to add big m method can any one help me?

Describe validate() and reset() methods, Validate() : Used to validate prop...

Validate() : Used to validate properties after they have been populated; known as before FormBean is handed to Action. Returns a collection of ActionError as ActionErrors. Followin

Series, Write a Java program to find the sum of 1+3+5+…. , for 10 terms in ...

Write a Java program to find the sum of 1+3+5+…. , for 10 terms in the series.

Write Your Message!

Captcha
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