Write program that uses a class named rectangle

Assignment Help JAVA Programming
Reference no: EM13696589

Program: Write program that uses a class named Rectangle. The class has floating point attributes length and width. it has member functions that calculate the perimeter and area of the rectangle. It also has set and get functions for both length and width.

The set functions verify that length and width are each floating-point numbers larger than 0.0 and less than or equal to 20.0.

 if invalid length or width are given, then length and width will be set to 1.0. A "predicate function" will determine if the rectangle is a square. (A square exists if the length and width differ by less than .0001).

The class will have a destructor that displays a message indicating that an object has "gone out of scope".

Part 1: The class will have 3 overloaded contractor functions. The first will have no parameters (In this function set the length and width to 1.0 in the body of the function.)

The second will have one parameter (length). (in this function set the width to 1.0 in the body of the function.) The third will have two parameters (length and width).

This third contractor will set length and width to 1.0 in the body of the function if the values for these members are invalid.

Part 2: error messages will indicate that an attempt has been made to create an object with invalid parameters.

Part 3: A header file will be used to declare the class. Other header files may be used if you wish. A separate .cpp file will be used to implement the class member functions. Hence, your program will consist of at least one header file and at least 2 .cpp files

You need to make well-formed and clean code and add comments in code section that will be useful in the future.

Reference no: EM13696589

Questions Cloud

Implement a class called singlylinkedlist : Prepare a C++ program that will run in Microsoft Visual Studio 2012 - In the main function, instantiate the SinglyLinkedList class. Your program should provide a user loop and a menu so that the user can access all the operators provided by the Sin..
Realize the circuit using nand gates : Realize Z = ABC + AD + C?D? Using only two-input NAND gates - Use as few gates as possible.
Find a two-level, multiple-output and-or gate circuit : Find a two-level, multiple-output AND-OR gate circuit to realize the subsequent functions. Minimize the required number of gates (six gates minimum).
Determine maximum current magnitude allowed by device : The voltage across a two terminal device is always 15.0 V. The maximum power the device can dissipate is 0.87 W - Determine the maximum current magnitude allowed by the device power rating.
Write program that uses a class named rectangle : Write program that uses a class named Rectangle. The class has floating point attributes length and width. it has member functions that calculate the perimeter and area of the rectangle. It also has set and get functions for both length and width.
Create a 2-dimensional array for the volume of concrete : Your Company constructs concrete hemispherical domes that range in diameter from 40 to 90 feet and increments of 5 feet.
Write a matlab code using for loop : Write a MATLAB code using "for" loop to compute y when n = 50,100 and 1000.
Implement a class person with two fields name : Implement a class Person with two fields name and age, and a class Car with three fields - implement a class that saves the details of the person.
Create a program that counts the number of numbers : you need to create a program that counts the number of numbers between 150 and 200 - Can you write this program in c language? You need to implement a function that counts the numbers.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Implement the fraction class

Implement the Fraction Class, Add the following functions into the definition of the Fraction class above main. The main function already has the calls to those functions written. You must write the required functions into the Fraction class such..

  How would you categorize this kind of script what resources

write a 200- to 300-word short-answer response to the following bull how would you classify this type of script? bull

  Application that will allow a new customer to order a house

Create an application that will allow a new customer to order a house. You'll allow the customer to choose among four models (Aspen, Britattany, Colonial, and Dartmoor) by creating separate ButtonGroups.

  Write java program to read in sequence of hourly temperature

Write down Java program which reads in sequence of hourly temperature readings over 24-hour period using arrays. Your program must find and show maximum and minimum temperatures.

  The api for this class ispublic void poweronnbsp sets the

the api for this class ispublic void poweronnbsp sets the machine ready to serve the selected ice creampublic void

  Determines the number of stages on the rocket

Write a program that reads these data and determines the number of stages on the rocket. Use the data file rocket2.txt. It contains a trailer line with the value -99 for all four values.

  Write down a java program which prints out all 92 solutions

write a java program which prints out all 92 solutions of the 8-queen problem but modify the program to display only

  Define render a model scene in java

Render a Model Scene in Java - Imagine you are prototyping animation for a Jurassic Park Movie

  Objective to learn the use of comments and basic math

objective to learn the use of comments and basic math operators.create a new folder called assign21 under

  What value would be returned from call to its size() method

If a collection stores 5 objects, what value would be returned from a call to its size() method?

  Need the build function.use recursion

Implement remaining function. Everything else is provided. Use given material to receive points. Implement remaining function. Everything else is provided. Use given material to receive points. Implement remaining function. Everything else is provide..

  Prepare an application that uses an array

Write an application that uses an Array to store 10 messages of type String. You will store this Array with 10 messages of your choosing. For example, a message could be "I love Java the programming language!"

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