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

  Java tv''s newest owner! java tv is the greatest tv channel

Java TV's newest owner! Java TV is the greatest TV channel ever, and it prides itself in its 24 hour interesting ' programming'. To help you run this channel you will need to write a  dynamic  program that uses  Data Lists  to store all its TV show i..

  Create an array of five employee objects

Create an array of five Employee objects. Prompt the user to enter data for each Employee. Do not allow duplicate ID numbers to be entered.

  Write a java program that (1) defines a base/super class a

Write a Java program that (1) Defines a base/super class A, a subclass B (inherits from A), and a subclass C (inherits from B). The A class must have a method f() which is not implemented in A,

  Build a very straightforward and fully functional machine

Build a very straightforward and fully functional machine learning classifier with the K-Nearest Neighbor (KNN) algorithm. The KNN model will read a set of data specified by the user, decide the appropriate class of the new instance, and finally o..

  Your task in this assignment is to develop a graphical user

your task in this assignment is to develop a graphical user interface based java program that can communicate with a

  Given a hash function hkey prepare a java simulation

given a hash function hkey prepare a java simulation program to determine each of the subsequent quantities after

  How to setup a program to respond to events

Discussing how to setup a program to respond to events from any one of these sources - How do you create the necessary listener class? How do you associate the listener object with the event source?

  What is an abstract class and how does it differ from the

question 1 what is an abstract class and how does it differ from a regular class? question 2 why are abstract class

  Discussion htmlcssjavascript placementnbspplease respond to

discussion htmlcssjavascript placementnbspplease respond to the followingcompare and contrast the process of adding

  Create a class called invoice that a hardware store may use

Create a class called Invoice that a hardware store may use to represent an invoice for an item sold at the store.  The class should have four (4) instance variables: part number : string and part description : string (what is the item)

  Class that stores information about a report

Create a class that stores information about a report containing multiple currency transactions in multiple currencies. This includes the name of the report and each of the transactions that occurred.

  Prepare a java program to play pig

Pig is a two player game where the players take turns repeatedly rolling a single 6 sided die. A player repeatedly rolls the die until one of two events happen:

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