Create a class with attributes length and width

Assignment Help JAVA Programming
Reference no: EM13879540

(1)

Create a class 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.

1317_Java.jpg

(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: EM13879540

Questions Cloud

Evaluate one-tailed and two-tailed tests : Analyze use of regression, Apply regression to research scenarios, Generate hypotheses, Evaluate one-tailed and two-tailed tests and Implement correlation in SPSS
Create effective navigation for the application or site : Create effective navigation for the application or site
Explain the economic interpretation of the dual problem : A farmer has 5,000 acres of land, 1,000 hours of labor, and 2,000 hours of tractor time to grow two crops: corn and wheat. He expects that he can earn $250 per acre for corn and $200 per acre for wheat.
Discusses the team leadership model : This chapter discusses the team leadership model and the various leadership decisions associated with facilitating the success of a team. The author discusses the strengths and criticisms of the model as well as its application to business practic..
Create a class with attributes length and width : Create a class 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 verif..
Create a visual logic flowchart that parallels pseudocode : Create a Visual Logic flowchart that parallels this pseudocode.
Solve this problem using the simplex method : Derive and graph the output supply functions for each crop. Output supply in this context is the relationship between acres produced and net profitability of the crop.
Did you summarize the article : Evaluation Criteria: Did you summarize the article? Did you describe how antisocial and pro-social behaviors are demonstrated in the article? Did you provide your answers in complete sentences with few grammatical errors
Solve this problem using the simplex method : Your optimal solution should indicate that no amount of feed f2 should be pur- chased and fed to the farmer's cows. By how much should feed f2's current price of $0.50 per pound decrease in order for the optimal solution to change?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a script that simulates a casino machine

Write a script that simulates a casino machine. To play a single round on the machine user pays $ 5. Now when the user start the machine, the machine rolls a pair of dice

  Create a two dimensional integer array in java

Create a two dimensional integer array in JAVA that produces the sum of rows and columns as selected by the user.

  Output the number of vowels

Prompt the user to enter a string, and using a loop, count and output the number of vowels, and consonants the string contains. (You have to find methods from class.)

  In this project you need to write a java program called

in this project you need to write a java program called mm.java to perform matrix multiplication. your code will read

  Record managing system application

Build a student record managing system application

  Bulloil company is planning a large pipeline from east to

bulloil company is planning a large pipeline from east to west x-axis across its oil fieldbullthe field has n

  Invoice application that validates the data

Code to the Invoice application that validates the data the user enters. That includes exception handling code as well as specific data validation methods

  Implement a program that will play the old guessing game

Your assignment is to implement a program that will play the old guessing game "I'm thinking of a number between 1 and 100". The program will be in a webpage

  The game of pig

Write a program that allows a single player to practice the game (that is, there will be no opponent, just a single player). Play 5 turns in the game to get a total score for the player. Refer to the sample output below for a detailed example.

  Understand actual communication with an smtp server

Understand actual communication with an SMTP server can be achieved using TCP Sockets and understand the development of a graphical user interface (GUI) and use of event handling.

  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

  Examples of cultural productions from three cultures

Using specific examples of cultural productions from three cultures -Sumerians, Archaic Greeks (800-480 BCE), Classical Greeks (480-323 BCE)- explain how cultural values and ideals are reflected in the creation and style of cultural productions.

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