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

  The program reads in names

Write a program and include the following methods. The program reads in names and ages (use 2 parallel arrays, maximum size 50) from a file called Stuff.dat.

  Calculate the largest divide by the smallest number

Please also calculate the largest divide by the smallest number provide the quotient and remainder and also put the information as a string on the applet. All the numbers will presented in two decimal places.

  The menu is displayed and the user must select

The menu is displayed and the user must select an option (a number between 0 and 7). The action corresponding to the selection is performed, then the menu is displayed again and the user can choose another option.

  Portable file system implement a portable file system with

implement a portable file system with java language. i do have some requirements.implement a portable file system pfs.

  Draw a uml diagram of each of the shapes

Draw a UML diagram of each of the Shapes, Rectangle and Square classes using the code that has been provided. Complete this using the examples that have been provide in the lecture slides.

  Determine the percentage of vowels

Create a Java program that asks the user to input a sentence in any language, counts the number of vowels in the sentence, divides it by the total number of characters in the sentence.

  Implement avl tree

Implement AVL trees that allows both iterative traversal and recursive traversal.

  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

  Write program using a switch statement that display polygon

Write a program using a switch statement that displays the name of a polygon with sides between 3 and 12 depending on the number entered by the user

  User enter a series of numbers

Design a java program with a loop that lets the user enter a series of numbers. The user should enter - 99 to signal the end of the series. After all the numbers have been enter been entered, the program should display the largest and smallest number..

  Write an application that uses string method region

Write an application that uses String method region - Matches to compare two strings input by the user. The application should input the number of characters to be compared and the starting index of the comparison.

  Variable of type string that has been assigned

Assume that word is a variable of type string that has been assigned a value. Write an expression whose value is a string consisting of the last three characters of the value word. So if if the value if word were "biggest" the expression's value w..

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