Create a class rectangle with attributes length and width

Assignment Help JAVA Programming
Reference no: EM13876003

(1) Create a class Rectangle with attributes length and width, each of which defaults to 1. Provide member function that calculate and the area of the rectangle. Also, provide set and get functions for the length and width attributes. The set function should verify that length and width are each floating-point numbers larger than 0.0and less than 20.0

(2) Imagine a tollbooth at a bridge. Cars passing by the booth are expected to pay a 50 cent toll. Mostly they do, but sometimes a car goes by without paying. The tollbooth keeps track of the number of cars that have gone by, and of the total amount of money collected. Model this tollbooth with a class called tollBooth. The two data items are a type unsigned int to hold the total number of cars, and a type double to hold the total amount of money collected. A constructor initializes both of these to 0. A member function called payingCar() increments the car total and adds 0.50 to the cash total. Another function, called nopayCar(),increments the car total but adds nothing to the cash total. Finally, a member function called display() displays the two totals. Include a program to test this class. This program should allow the user to push one key to count a paying car, and another to count a nonpaying car. Pushing the Esc key should cause the program to print out the total cars and total cash and then exit.

(3) Create a class that includes a data member that holds a "serial number" for each object created from the class. That is, the first object created will be numbered 1, the second 2, and so on. To do this, you'll need another data member that records a count of how many objects have been created so far. (This member should apply to the class as a whole; not to individual objects. What keyword specifies this?) Then, as each object is created, its constructor can examine this count member variable to determine the appropriate serial number for the new object. Add a member function that permits an object to report its own serial number. Then write a main() program that creates three objects and queries each one about its serial number. They should respond I am object number 2,and so on.

(4) Create a class for time. There should be at least three functions
1. convertToSec(int hour, int min , int second, out intsecResult)
2. addSeconds(int,int)
3. convertToHMS(int)

User enters hours, minutes and seconds which will be converted into seconds by class function and stores result in secResult which is pass by reference variable. Then addSeconds function took two parameters, one is secResult which is the result of convertToSecand other is seconds, this function will add seconds and returns them as integer. After adding seconds then user call a function convertToHMS which has one parameter which took seconds as integer and convert back into Hours, Minutes and Seconds. After creating these functions use all of above functions in main function and show its execution one by one by assuming some values.

(5) Create a class called Employee that includes three pieces of information as data members, a name (type string), ID (type integer) and a monthly salary (type integer). Employee class should have a constructor that initializes the three data members. Provide a "setData" and a "getData" function for each data member. Write a test program that demonstrates class Employee's functionalities. Create two Employee objects and display each object's yearly salary.

(6) Generate code for the Given scenario.

(7) A cuboid is a three-dimensional shape having different measurements in each dimension say x,y, and z. Cuboids shapes are often used for boxes, cupboards,rooms,buildings, etc. So keeping in the mind the importance of Cuboids you have to implement the following functionalities.

(i) Declare a class Cuboids with its three data members of type float to have the measurements of the three dimensions.

(ii) Value should only be assigned to the data members when it is greater than 0 and lesser than 35.00

Write all the set functions for each data members to set values.

(iii) Implement default(sets all data members to 1),parameterized and copy constructor.

(iv) Provide a member function for taking the inputs for a particular object's data

Reference no: EM13876003

Questions Cloud

Closing financial statements for its first year in business : In its closing financial statements for its first year in business, ABC Enterprises, had cash of $242, accounts receivable of $850, inventory of $820, net fixed assets of $3,408, retained earnings of $1,620, net sales of $2,768, cost of goods sold of..
Describe the creation and flow of cerebrospinal : Describe the creation and flow of Cerebrospinal Fluid in the Central Nervous System
Assuming it must issue new stock to finance capital budget : Assume that you are an intern with the Nicholas Enchilada's Inc., and you have collected the following data: The yield on the company's outstanding bonds is 7.75%; its tax rate is 40%; the next expected dividend is $0.50 a share; What is the firm's W..
Key metrics on the financial statements firm value : Use the following financial statement(s) to answer the questions below: Balance sheet of XYZ - Canada Cash CD 1000000 Debt 5000000 AR 3000000 Equity 6000000 FA 5000000 Inventory 2000000 CD 11000000 CD 11000000 Dollar Translation on May 31 CD2=$1 Cash..
Create a class rectangle with attributes length and width : Create a class Rectangle with attributes length and width, each of which defaults to 1. Provide member function that calculate and the area of the rectangle.
New storage facility-fulfil all of the loan payments : Orange Spark, Inc. just purchased a new storage facility. The company will begin making loan payments of $15513 at the end of year 5. Orange Spark will make a payment at the end of each year for 11 years. How much should Orange Spark deposit today, i..
Purchase of new machine for the production of latex : Vandalay Industries is considering the purchase of a new machine for the production of latex. Machine A costs $3,102,000 and will last for six years. Variable costs are 40 percent of sales, and fixed costs are $245,000 per year. Both machines will be..
Explain the terms job description and job specification : Explain the terms job description, job specification, and job evaluation
Find the payment that should be used for the annuity due : Find the payment that should be used for the annuity due whose future value is given. Assume that the compounding period is the same as the payment period. $8000; quarterly payments for 8 years; interest rate 4.1%.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a program that has an array of given length

Create a program that has an array of length 100 which will automatically be filled with randomly generated numbers between 1-100 each time the program is run

  Java socket hello i need to this assignment done in net

hello i need to this assignment done in net beans . and i want comment in code .also screen shots of running program

  Create a class that implements movieloader

Fill in the empty Frame class that has been provided. Each object of this type will store data consisting of a single frame from an input le.

  Class pointparameters

What is the output of the following Java program? Explain in terms of how parameters are passed in Java.import java.awt.*;class PointParameters

  Design and implement your own simple class to represent

Design and implement your own simple class to represent any household item of your choice (toaster, fan, hair dryer, piano ...) Your class should have a constructor, one additional method and at least one member variable (e.g. boolean isOn to turn th..

  Write a program that prompts the user for a start date

You need to write a program that prompts the user for a start date and an end date and then prints all of the dates between them (inclusive), with seven tab-separated dates on each line.

  Implement a generic class set

Implement a generic class Set that maintains a set of items of generic type T using the class LinkedList in the Java API. Your Set class must provide the subsequent functionality:

  Ood methodology

Your local police department wants to design new software to keep track of people, property, and criminal activity. List at least three classes you think should be in the design. For each class, identify some data members and methods.

  Return a reverse queue

represent my queue object as a parameter, what the program should be doing. It should return a reverse queue

  Calculate the area and circumference of a circle

Write a program to move and calculate the area and circumference of a circle. - Calculate function, which passes the radius by value, and get back the area (PI*radius*radius) and circumference (2*PI*radius) of the circle through reference

  Write down a java gui application index2java based on the

write a java gui application index2.java based on the program in step 1 that inputs several lines of text and uses

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