free geoip

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cs201 assignment no 3 idea solution spring June 2011
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
Assignment No. 3
Semester: Spring 2011
CS201: Introduction to Programming Total Marks: 20

Due Date:13 June, 2011

Instructions:
Please read the following instructions carefully before submitting your assignment:
It should be clear that your assignment will not get any credit if:

 The assignment is submitted after due date.
 The submitted assignment does not open or file is corrupt.

All types of plagiarism are strictly prohibited.

Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted. If you will submit code in any other file format like .doc or .txt etc. you will get zero marks.

Objective
The objective of this assignment is to provide hands on experience of using

 Macros in C/C++
 Classes in C/C++
 Creating Default constructors and User-defined constructors
 Creating and manipulating objects.

Guidelines
 Code should be properly aligned and well commented.
 Follow C/C++ rules while writing variables names, function names etc.
 Use only Dev-C++ IDE for this assignment.
Assignment

Problem Statement: Circle Area & Circumference Calculation

You are required to write a program which will calculate the area and circumference of the circle by declaring a class. You must declare a class named Circle whose only data member will be radius which should be declared as public. You need to define a macro for the value of PI which will be used while calculating the area of the circle.


Detailed Description:

• Data member radius should be of type double and it should be declared under public scope.

• Value for PI should be defined using #define macro.

• Your class should have two type of constructors:

1. Default Constructor which should initialize radius of the circle with value 0.

2. User Defined Constructor which takes class data member radius as its parameter.

• Declare a public member function named CalculateArea() which calculates the area of the circle. The formula for calculating the area is .

• Declare a public member function named CalculateCircum() which calculates the circumference of the circle. The formula for calculating the circumference is .

• Declare a public member function named Display which will display the calculated area and circumference of the circle on the output screen.

• In the main() function, declare two objects of type Circle:

o One using default constructor
o Second using user-defined constructor.

It should be Display the area and circumference of the circle on the screen like the sample output.


Sample Output:

Radius of the Circle = 0
Area of the Circle = 0
Circumference of the Circle is = 0


Radius of the Circle = 3.5
Area of the Circle = 38.465
Circumference of the Circle is = 21.98



Deadline:
Your Assignment solution must be submitted on or before June 13, 2011. You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted. Assignment submitted in any other file format like .doc or .txt etc. you will get zero marks.


Attached Files
.doc   Spring 2011_CS201_3.doc (Size: 163.5 KB / Downloads: 867)

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply
#2
[size=24]CS201 Assignment 3 Spring 2011[/SIZE]

#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
float radius;
float fAreaCircle;
float fCircumferenceCircle;

cout << "\nEnter the radius of circle: " ;
cin >> radius;

cout << "\nThe radius of circle is: " << radius << endl;

fAreaCircle = (M_PI * radius) * radius;
fCircumferenceCircle = (2.0 * M_PI) * radius;

cout << "The area of the circle is: " << fAreaCircle << endl;
cout << "The circumference of the circle is: " << fCircumferenceCircle << endl;

system("Pause");
return 0;
}
Reply
#3
thanks for sharing

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply
#4
Another Idea Solution CS201 Assignment 3 Spring 2011


#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
#define PI 3.14
class Circle
{
public:
double radius;
Circle();
Circle(double);
double calculateArea(double);
double calculateCircum(double);
void display();
};
Circle::Circle()
{
radius = 0;
}
Circle::Circle(double r)
{
radius = r;
}
double Circle::calculateArea(double r)
{
return (PI*r*r);
}
double Circle::calculateCircum(double r)
{
return (2*PI*r);
}
void Circle::display()
{
cout << "Radius of the Circle is " << Circle::radius << endl;
cout << "Area of the Circle is " << calculateArea(Circle::radius) << endl;
cout << "Circumference of the Circle is " << calculateCircum(Circle::radius) << endl << endl;
}
main()
{
Circle circle1;
Circle circle2(3.5);
circle1.display();
circle2.display();
system("pause");
}

.rar   Spring 2011_CS201_3 Solution.rar (Size: 433 bytes / Downloads: 275)


Attached Files
.rar   CS201_3rdassign.rar (Size: 420 bytes / Downloads: 420)
Reply
#5
it will dear.
Reply
#6
dont you know?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CS301 Assignment # 4 Due Date: 02-Feb-2016 Vuhelper 0 2,356 02-03-2016, 05:38 PM
Last Post: Vuhelper
  CS703 – Advanced Operating Systems Assignment No.3 solution January 2016 Vuhelper 0 5,943 01-23-2016, 09:58 PM
Last Post: Vuhelper
  CS601 Data Communication Assignment No. 03 Solution 23rd January 2016 Vuhelper 1 1,970 01-23-2016, 06:09 PM
Last Post: Vuhelper
  CS403 Assignment No. 03 Solution 23rd January 2016 Vuhelper 2 1,212 01-23-2016, 03:18 PM
Last Post: Vuhelper
  CS506 Web Design and Development Assignment no 3 Solution 3rd January 2016 Vuhelper 0 2,280 01-23-2016, 03:16 PM
Last Post: Vuhelper
  CS724 Software Process Improvement Assignment No 01 Solution 20th January 2016 Vuhelper 0 2,007 01-20-2016, 06:26 PM
Last Post: Vuhelper
  CS711 Software Design Assignment No 01 Solution Due Date Feb 12, 2016 Vuhelper 0 1,702 01-20-2016, 06:24 PM
Last Post: Vuhelper
  CS709 Formal Methods for Software Engineering Assignment No 01 Solution January 2016 Vuhelper 0 1,838 01-20-2016, 06:22 PM
Last Post: Vuhelper
  cs703 assignment no 3 Solution 20th January 2016 Vuhelper 0 1,739 01-20-2016, 06:20 PM
Last Post: Vuhelper
  CS704 Assignment No. 01 Solution January 2016 Vuhelper 0 4,833 01-20-2016, 06:19 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support