Main program should instantiate an instance

Assignment Help C/C++ Programming
Reference no: EM13161718

The program will use as the input, the length and width of a rectangle. The output of the program will be the area and perimeter of the rectangle.

Your program will contain a class called Rectangle. The class should also have at least two, and maybe more, member functions. One for getting, from the user, the length and width of the rectangle and the second for printing the area and perimeter of the rectangle. The input provided by the user must be greater than 0 and less than or equal to 20.0. If the user enters data that is less than or equal to 0 or greater than 20.0, then the program should output an appropriate error message.

The main program should instantiate an instance of the class Rectangle and then make calls to the member functions to input the data and output the results. The main program should only make calls to the member functions. No input or output should be done from the main program.

Calculations should be as follows.

Area = length * width

Perimeter = (2 * length) + (2 * width)

For the purposes of this program you can assume that that no character data will be used for input. However, do not assume that the input will be within the above specified range.

Also, for the purposes of this program you can use the following main() function.

void main()

{

    Rectangle R;

    R.getData();

    R.printData();

    return 0;

}

Reference no: EM13161718

Questions Cloud

Method named printgrid : Write a method named printGrid that accepts two integer parameters rows and cols. The output is a comma-separated grid of numbers where the first parameter (rows) represents the number of rows of the grid and the second parameter (cols) represents th..
Minimum contacts test : Compare the minimum contacts test, as it is applied to the bricks-and-mortar activity of businesses, to their cyberspace activity. If you were a small business
Write a function to arrange 10 numbers stored in an arraye : Writ a funtion to arrange 10 numbers stored in an array forom the largest to the smallest and pass the results to main program.
Program should display a menu : The program should display a menu allowing the user to enter pointer values by selecting option 1, then perform shallow or deep copy by selecting options 2 or 3. After whcich, your program needs to display the new results after the copy is performed.
Main program should instantiate an instance : The main program should instantiate an instance of the class Rectangle and then make calls to the member functions to input the data and output the results
Delete all sub-directories within : Delete all sub-directories within "temp" directory if not empty. In Python program change the current working directory to [temp].
Program that reads a series of whitespace : Write a program that reads a series of whitespace delimited strings from stdin and prints them back out, separated by spaces, in lexicographic order. You may assume that all strings are lower case and that no string has more than 20 characters.
The graphics frame class and the drawable interface : This lab makes use of the GraphicsFrame class and the Drawable interface. Your missions is to create the class Airplane.
After the array is created and loaded : After the array is created and loaded, the problem is then to sort the array and print out the contents of the sorted array. Please use a separate function for the sort routine and also a separate function for the print out of the array.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a c++ program containing a linked list of 10 integer

Write a C++ program containing a linked list of 10 integer numbers. Have the program display the numbers in the list.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Program that stores a series of numbers in a binary tree

Write a program that stores a series of numbers in a binary tree

  Prepare the weighted scoring model for three exams

Prepare the weighted scoring model. Final grades are based on three exams worth 15%, 20%, and 25%, respectively; homework is worth 20%.

  Write program which prompts user to enter numbers

Write down the program which prompts the user to enter numbers, findsout how many positive and negative values have been entered, and calculates sum and average of numbers entered.

  Takes a string containing a full name

Write a program that takes a string containing a full name and outputs each part of the name separately with its length. The name should be in the form of first, middle, and last name, separated from each other by a single space. For example, if the ..

  Implement a semantic analysis

The program will implement Semantic Analysis. The assignment provides two options to define variable scope, either using the Global Option or the Local Option.

  Program to translates letter grade into number grade

In C++ (should be able to compile in Visual Studio 2010): Write a program to translates letter grade into number grade. Letter grades are A,B,C,D and F, possibly followed by a + or -.

  Write program using c language to find page fault

Write program using c language to find page fault for individual processes, group of processes and system as whole using following system call int sys_pgfltstats(pid_t pid,int flag,pf_info_struct *info).

  Calculate the trajectory of a soccer ball

Write a program to calculate the trajectory (flight path) of a soccer ball

  Create a program for a company named retail-mart

Prompt the user to enter an item name (one word only), a quantity and a price. For this step, in addition to functionality, I'll be looking at: location of the variable declarations; appropriateness of data types selected; appropriateness of the va..

  Write function to accept character array

Write down the C++ function which will accept the character array of at most 30 cells. Your function must return true if string and its reverse are identical;

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