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

  Modify each sorting algorithm

Modify each sorting algorithm so that it keeps track of the number of comparisons it performs and the number of exchanges (swaps) it performs during a single sorting operation. Keep track of these numbers using two long integer counters

  Method to store the product of the two arrays in third array

Write a method to store the product of the two arrays in the third array

  Assume an ideal gas mixture is in contact with water

Assume an ideal gas mixture is in contact with water. Determine the equilibrium concentration of the contaminant in the liquid is the gas stream is composed of 200 ppm of benzene in air

  Display the earliest and latest dates that appear in a data

display the earliest and latest dates that appear in a data file, and the number of times that they appear. I have already parsed all of the dates from their original string to their corresponding int values.

  Java program for line item application

This exercise explains you the process of testing and enhancing Line Item application. Open LineItemApp, Validator, Product, LineItem, and ProductDB classes that are in the c:java1.6ch06LineItem directory and review this code.

  Organization structure change over time

How and why did the organization structure change over time, and in what ways were some of these changes responsible for some of their recent problems?

  Your program should ask the user to input a grade

Your program should ask the user to input a grade (integer from 1-100) and then output the letter grade.

  Application that reads the lengths of sides of a triangle

Write a java application that reads the lengths of the sides of a triangle from the user.

  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

  1design an abstract data type in java that represents a

1.design an abstract data type in java that represents a musical pitch noteadt.java. the adt should store the note or

  We will simulate a very simple network by having a process

we will simulate a very simple network by having a process correspond to a node in the network and files correspond to

  Create a japplet

Create a JApplet that contains a JLabel and JButton. You'll create a JButton that will automatically change font typeface, style, and size when clicked by the user.

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