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 class called rationalnumber

Write a class called RationalNumber that represents a fraction with an integer numerator and denominator.

  Implement program that uses priority queues of strings

Write a program in Java that uses priority queues of strings to sort lines of text in reverse alphabetic order. You may choose how you define alphabetic order.

  Create an interface called transcripts

You are going to create an interface called Transcripts with 2 methods: getGPA() and getTotalCredits(). Implement these methods in the Student class you created for Assignment

  Creating a grade book that will use arrays

You will be creating a grade book that will use arrays to store students and their grades. The breakdown of the project is as follows. You must be able to add a student, remove a student, edit a student, remove all students, and exit the program

  What is mean by swing and awt

What is mean by Swing and AWT and compare the statements break and continue with example in terms of their functions

  Implement an iterative method with a for loop

Different scientists have developed Predator-Prey models to try to understand the interactions and foresee the evolution of the populations.

  Describe which base class members may not be inherited

Without considering the access attributes, list and describe which base class members may not be inherited by a derived class and provide a rationale for why this is.

  Creates a professorraing class consisting of professor ID

Write a program that creates a professorRaing class consisting of professor ID and three ratings. The three ratings are used to evaluate easiness, helpfullness, and clarity. In a separate implementation class, allow the user to enter the values.

  Write a java application that allows the user to read

Write a java application that allows the user to read, validate, store, display, sort and search the internet account number (integer number), usage (integer number) and cost (double number) for N customers. N should be declared as a constant and it ..

  Describe a multidimensional array

Describe a multidimensional array for a summer camp, the first array would be the number of kids say 30, then it would break them up by ages 6-9 (4 different groups) and lastly by sex m or f.

  Java application to generate three-digit random number

Write a Java application that generates a 3-digit random number 100 times. Display the output for each of the generated numbers and the sum of all 100 numbers.

  Write a class and client class that stores hotels ratings

Write a class and client class that stores hotels ratings over the years. The number of stars represents hotel ratings. Use a two dimensional integer array to represent the years and hotels

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