Design and implement class circle to represent circle

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

CS 1321L: Programming and Problem
Solving I Lab

Exercise #1: Design and implement class Circle to represent a circle object. The class defines the following attributes (variables) and methods:

A private variable of type double named radius to represent the radius. Set to 1.
Constructor Methods:
C# & Java: Default Constructor with no arguments.
C# & Java: Constructor method that creates a circle with user-specified radius.
Method getRadius() that returns the radius.
Method setRadius() that sets the radius.
Method getArea() that returns the area.
Method getPerimeter() that returns the perimeter.
Method toString()to printout a meaningful description of the circle as follows:

The circle has radius X. Where X is the value of variable radius.

Now design and implement a test program to create a default circle object and test all class methods on the object. Print the object after each method call and use meaningful label for each method call as shown in the following sample run.

Sample run:

Print radius:
The radius is 1.

Print area:
The area is 3.14

Print perimeter:
The perimeter is 6.28

Set radius to 10 and print the object: The circle has radius 10.

Print area:
The area is 314.23

Print perimeter:
The perimeter is 62.81

Exercise #2: Design and implement class Radio to represent a radio object. The class defines the following attributes (variables) and methods:

Assume that the station and volume settings range from 1 to 10.

A private variable of type int named station to represent a station number. Set to 1.
A private variable of type int named volume to represent the volume setting. Set to 1.
A private variable of type boolean named on to represent the radio on or off. Set to false.
A non-argument constructor method to create a default radio.
Method getStation() that returns the station.
Method getVolume() that returns the volume.
Method turnOn() that turns the radio on.
Method turnOff() that turns the radio off.
Method stationUp() that increments the station by 1 only when the radio is on.
Method stationDown() that decrements the station by 1 only when the radio is on.
Method volumeUp() that increment the volume by 1 only when the radio is on.
Method volumeDown() that decrements the volume by 1 only when the radio is on.
Method toString()to printout a meaningful description of the radio as follows(if the radio is on):

The radio station is X and the volume level is Y. Where X and Y are the values of variables station and volume. If the radio is off, the message is: The radio is off.
Now design and implement a test program to create a default radio object and test all class methods on the object in random order. Print the object after each method call and use meaningful label for each method call as shown in the following sample run.

Sample run:

Turn radio on:
The radio station is 1 and the volume level is 1.

Turn volume up by 3:
The radio station is 1 and the volume level is 4.

Move station up by 5:
The radio station is 6 and the volume level is 4.

Turn volume down by 1:
The radio station is 6 and the volume level is 3.

Move station up by 3:
The radio station is 9 and the volume level is 3.

Turn radio off.
The radio is off.

Turn volume up by 2: The radio is off.

Turn station down by 2: The radio is off.

Attachment:- Programming and Problem.rar

Verified Expert

The task of the program is to develop 2 C# program. The program test the knowledge of classes. The code is well documented and commented and output is documented too. The program 1 helps to determine the area and perimeter of circle. The program 2 helps to control the audio of the radio

Reference no: EM132395731

Questions Cloud

How would identifying a mentoring project activities : How would identifying a mentoring project's activities and processes (e.g., observing documenting, reflecting, analysis, application, feedback, goal-setting.
Create your strategic mentoring plan using given details : The summative assignment is a compilation of the revised assignments from weeks one through six. Using the feedback, you receive from the instructor.
Discuss topic immigrant children and their families : Topic: Immigrant children and their families, Papers are to be 10-12 pages (not counting title, abstract, or reference pages), must use APA format.
Prepare a data analysis report for PhD using SPSS AMOS : Prepare a data analysis report for PhD using SPSS AMOS. The AIM of this research is to gather information on the relationship between Entrepreneurial.
Design and implement class circle to represent circle : Design and implement class Circle to represent a circle object. The class defines the following attributes (variables) and methods
What are the business costs or risks of poof data quality : What are the business costs or risks of poof data quality? Support your discussion with at least 3 references. What is data mining? Support your discussion.
Analysis of the relevant privacy risks of selected carbon : Analysis of the relevant privacy risks of the selected Carbon Black products, a one-page executive summary for the Acme Dynamics Board and C-Suite.
What you think about all of the given strange incidents : Your boss mentions that recently a number of employees have received calls from individuals who didn't identify themselves and asked a lot of questions about.
Early years learning framework : Select one topic from each of the following groups and, in 500 words, explain how it applies to early childhood education as outlined in the Early Years

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  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

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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