Java identifiers and variable class, JAVA Programming

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;

Posted Date: 3/9/2013 5:48:23 AM | Location : United States







Related Discussions:- Java identifiers and variable class, Assignment Help, Ask Question on Java identifiers and variable class, Get Answer, Expert's Help, Java identifiers and variable class Discussions

Write discussion on Java identifiers and variable class
Your posts are moderated
Related Questions
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 cla

Employee application Project Description: Subsequent Technology should be used 1) UI (jsp, jstl ,html, etc) 2) Framework (Spring MVC and hibernate) 3) Database (MYSQ

Implicit objects are formed by the web container and have information related to a particular request, page, or application. They are request, response, pageContext, session, appli

write a program in java using array and scanner class to generate padovan series

Comparable interface: The "Comparable" allows itself to compare with other same types of object. The function compareTo() is specified in the interface. Several of the standa

A final class will not be extended i.e. A final method cannot be overridden when its class is added. You can't modify value of a final variable.

We want an E Commerce site Project Description: We want an E Commerce site like fifacointrader.. You must have experience with that kind of work We will award the proje

JavaScript supports the normal control structures: The conditionals if, if...else, & switch; The iterations for, while, do...while, break, & continue;

What is Resuscitation Trolley explain their features? A proper resuscitation kit is mandatory for the ICU. In addition to trolleys that can be moved around the ICU there should

for $9.95 per month, 10 hours of access are provided.Additional hours are $2.00 per hour