Create a class 'Degree' having a method 'getDegree' that prints "I got a degree". It has two subclasses namely 'Undergraduate' and 'Postgraduate' each having a method with the same name that prints "I am an Undergraduate" and "I am a Postgraduate" respectively. Call the method by creating an object of each of the three classes.
Programming Skills
July 26, 2019
Create a class 'Student' with three data members which are name, age and address. The constructor of the class assigns default values name as "unknown", age as '0' and address as "not available". It has two members with the same name 'setInfo'. First method has two parameters for name and age and assigns the same whereas the second method takes has three parameters which are assigned to name, age and address respectively. Print the name, age and address of 10 students.
Programming Skills
July 26, 2019
Create a class 'Student' with three data members which are name, age and address. The constructor of the class assigns default values name as "unknown", age as '0' and address as "not available". It has two members with the same name 'setInfo'. First method has two parameters for name and age and assigns the same whereas the second method takes has three parameters which are assigned to name, age and address respectively. Print the name, age and address of 10 students.
Create a class to print the area of a square and a rectangle. The class has two methods with the same name but different number of parameters. The method for printing area of rectangle has two parameters which are length and breadth respectively while the other method for printing area of square has one parameter which is side of square.
Programming Skills
July 26, 2019
Create a class to print the area of a square and a rectangle. The class has two methods with the same name but different number of parameters. The method for printing area of rectangle has two parameters which are length and breadth respectively while the other method for printing area of square has one parameter which is side of square.
Create a class to print an integer and a character with two methods having the same name but different sequence of the integer and the character parameters. For example, if the parameters of the first method are of the form (int n, char c), then that of the second method will be of the form (char c, int n).
Programming Skills
July 24, 2019
Create a class to print an integer and a character with two methods having the same name but different sequence of the integer and the character parameters.For example, if the parameters of the first method are of the form (int n, char c), then that of the second method will be of the form (char c, int n).
Create a class named 'PrintNumber' to print various numbers of different datatypes by creating different methods with the same name 'printn' having a parameter for each datatype.
Programming Skills
July 24, 2019
Create a class named 'PrintNumber' to print various numbers of different datatypes by creating different methods with the same name 'printn' having a parameter for each datatype.
Create a class named 'Shape' with a method to print "This is This is shape". Then create two other classes named 'Rectangle', 'Circle' inheriting the Shape class, both having a method to print "This is rectangular shape" and "This is circular shape" respectively. Create a subclass 'Square' of 'Rectangle' having a method to print "Square is a rectangle". Now call the method of 'Shape' and 'Rectangle' class by the object of 'Square' class.
Programming Skills
July 24, 2019
Create a class named 'Shape' with a method to print "This is This is shape". Then create two other classes named 'Rectangle', 'Circle' inheriting the Shape class, both having a method to print "This is rectangular shape" and "This is circular shape" respectively. Create a subclass 'Square' of 'Rectangle' having a method to print "Square is a rectangle". Now call the method of 'Shape' and 'Rectangle' class by the object of 'Square' class.
Create a class named 'Rectangle' with two data members 'length' and 'breadth' and two methods to print the area and perimeter of the rectangle respectively. Its constructor having parameters for length and breadth is used to initialize length and breadth of the rectangle. Let class 'Square' inherit the 'Rectangle' class with its constructor having a parameter for its side (suppose s) calling the constructor of its parent class as 'super(s,s)'. Print the area and perimeter of a rectangle and a square.
Programming Skills
July 24, 2019
Create a class named 'Rectangle' with two data members 'length' and 'breadth' and two methods to print the area and perimeter of the rectangle respectively. Its constructor having parameters for length and breadth is used to initialize length and breadth of the rectangle. Let class 'Square' inherit the 'Rectangle' class with its constructor having a parameter for its side (suppose s) calling the constructor of its parent class as 'super(s,s)'. Print the area and perimeter of a rectangle and a square.
Create a class named 'Member' having the following members: Data members 1 - Name 2 - Age 3 - Phone number 4 - Address 5 - Salary
Programming Skills
July 24, 2019
Create a class named 'Member' having the following members:
Data members
1 - Name
2 - Age
3 - Phone number
4 - Address
5 - Salary
It also has a method named 'printSalary' which prints the salary of the members.Two classes 'Employee' and 'Manager' inherits the 'Member' class. The 'Employee' and 'Manager' classes have data members 'specialization' and 'department' respectively. Now, assign name, age, phone number, address and salary to an employee and a manager by making an object of both of these classes and print the same.
Create a class with a method that prints "This is parent class" and its subclass with another method that prints "This is child class".
Programming Skills
July 24, 2019
Create a class with a
method that prints "This is parent class" and its subclass with
another method that prints "This is child class". Now, create an
object for each of the class and call
1 - method of parent class by object of parent
class
2 - method of child class by object of child
class
3 - method of parent class by object of child
class
Write a C++ program to find the Maximum and Minimum number of a given array of integers
Programming Skills
March 25, 2019
Write a C++ program to find the Maximum and Minimum number of a given array of integers
Write a C++ program to find the largest element of a given array of integers.
Programming Skills
March 25, 2019
Write a C++ program to find the largest element of a given array of integers.
Write a program to calculate the monthly telephone bills as per the following rule: Minimum Rs. 200 for upto 100 calls. Plus Rs. 0.60 per call for next 50 calls. Plus Rs. 0.50 per call for next 50 calls. Plus Rs. 0.40 per call for any call beyond 200 calls
Programming Skills
March 19, 2019
Write a program to calculate the monthly telephone bills as per the following rule:
Minimum Rs. 200 for upto 100 calls.
Plus Rs. 0.60 per call for next 50 calls.
Plus Rs. 0.50 per call for next 50 calls.
Plus Rs. 0.40 per call for any call beyond 200 calls.
In a company an employee is paid as under: If his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and DA = 90% of basic salary. If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary. If the employee's salary is input by the user write a program to find his gross salary.
Programming Skills
March 19, 2019
In a company an employee is paid as under:
If his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and DA = 90% of basic salary.If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary. If the employee's salary is input by the user write a program to find his gross salary.
Write a program to check whether a triangle is valid or not, when the three angles of the triangle are entered by the user. A triangle is valid if the sum of all the three angles is equal to 180 degrees.
Programming Skills
March 19, 2019
Write a program to check whether a triangle is valid or not, when the three angles of the triangle are entered by the user. A triangle is valid if the sum of all the three angles is equal to 180 degrees.
If the ages of Ali, Hassan and Asad are input by the user, write a program to determine the youngest of the three.
Programming Skills
March 19, 2019
If the ages of Ali, Hassan and Asad are input by the user, write a program to determine the youngest of the three.
Write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred. Cost price and selling price of an item is input by the user
Programming Skills
March 19, 2019
Write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred. Cost price and selling price of an item is input by the user.
Write a program to calculate the total expenses. Quantity and price per item are input by the user and discount of 10% is offered if the expense is more than 5000.
Programming Skills
March 19, 2019
Write a program to calculate the total expenses. Quantity and price per item are input by the user and discount of 10% is offered if the expense is more than 5000.
Any integer is input by the user. Write a program to find out whether it is an odd number or even number.
Programming Skills
March 19, 2019
Any integer is input by the user. Write a program to find out whether it is an odd number or even number.
Write a program that inputs two numbers and displays the greatest common divisor of both numbers.
Programming Skills
March 19, 2019
Write a program that inputs two numbers and displays the greatest common divisor of both numbers.
Write a program that inputs a positive number.It then display the sum of all odd numbers and then sum of all even numbers from 1 to the number entered by the user.
Programming Skills
March 19, 2019
Write a program that inputs a positive number.It then display the sum of all odd numbers and then sum of all even numbers from 1 to the number entered by the user.
Write a program that displays first five numbers and their sum using while loop.
Programming Skills
March 19, 2019
Write a program that displays first five numbers and their sum using while loop.
Write a program that inputs a character from the user and checks whether it is a vowel or consonant
Programming Skills
March 18, 2019
Write a program that inputs a character from the user and checks whether it is a vowel or consonant
Write a program that inputs number of week’s day and displays the name of the day. For example if user enters 1,it display “Friday” and so on.
Programming Skills
March 18, 2019
Write a program that inputs number of week’s day and displays the name of the day. For example if user enters 1,it display “Friday” and so on.
Write a program that inputs two integers. It determines and prints if the first integer is a multiple of second integer.
Programming Skills
March 18, 2019
Write a program that inputs two integers. It determines and prints if the first integer is a multiple of second integer.
Write a program that inputs a year and finds whether it is a leap year or not ?
Programming Skills
March 18, 2019
Write a program that inputs a year and finds whether it is a leap year or not ?
Write a program that take inputs three numbers and display the maximum number.
Programming Skills
March 18, 2019
Write a program that take inputs three numbers and display the maximum number.
.Write a program that inputs two numbers and finds if second numbers is square of first.
Programming Skills
March 18, 2019
Write a program that inputs two numbers and finds if second numbers is square of first.
Write a program that inputs two numbers and finds wether both are equal or not .
Programming Skills
March 18, 2019
Write a program that inputs two numbers and finds wether both are equal or not .
#include<iostream>
using namespace std;
int main()
{
int a,b;
cout<<"\t Equality Calculator "<<endl;
cout<<"\n";
cout<<"Enter the First Number"<<endl;
cin>>a;
cout<<"Enter the Second Number"<<endl;
cin>>b;
if (a==b)
{
cout<<"\n";
cout<<"The entered numbers are equal"<<endl;
}
else
{
cout<<"\n";
cout<<"The entered numbers are not equal"<<endl;
}
}
Write a program that will prompt the user to enter number of hours.It computes and displays the numbers of week, days, hours within the input number of hours.
Programming Skills
March 18, 2019
Write a program that will prompt the user to enter number of hours.It computes and displays the numbers of week, days, hours within the input number of hours.
Write a program that inputs a three digit number from the user and display it in reverse order. For example if the user enter 123, it display 321.
Programming Skills
March 18, 2019
Write a program that inputs a three digit number from the user and display it in reverse order. For example if the user enter 123, it display 321.
Write a program that converts a person’s height from inches to centimeters using the formula 2.54*height.
Programming Skills
March 18, 2019
Write a program that converts a person’s height from inches to centimeters using the formula 2.54*height.
Write a program that gets temperature from user in Celsius and converts it into Fahrenheit using formula: F=9/5*C+32.
Programming Skills
March 18, 2019
Write a program that gets temperature from user in Celsius and converts it into Fahrenheit using formula: F=9/5*C+32.
#include<iostream>
using namespace std;
int main()
{
float c,f;
cout<<"\t Celsius to Fahrenheit Convertor "<<endl;
cout<<"\n";
cout<<"Enter the temperature in Celsius "<<endl;
cin>>c;
f=(c*9/5)+32;
cout<<"\n";
cout<<"Temperature in Fahrenheit is "<<f<<endl;
}
Write a program that inputs time in seconds and converts it into hh-mm-ss format.
Programming Skills
March 18, 2019
Write a program that inputs time in seconds and converts it into hh-mm-ss format.
#include<iostream>
using namespace std;
int main()
{
int t,h,m,s;
cout<<"\t Changing Time Format "<<endl;
cout<<"\n";
cout<<"Enter time (in Seconds) "<<endl;
cin>>t;
h=t/3600;
t=t%3600;
m=t/60;
t=t%60;
s=t;
cout<<"\n";
cout<<"Time in HH:MM:SS is "<<h<<":"<<m<<":"<<s<<endl;
}
Write a program that inputs dividend and divisor.It then calculate and display the quotient and remainder.
Programming Skills
March 18, 2019
Write a program that inputs dividend and divisor.It then calculate and display the quotient and remainder.
#include<iostream>
using namespace std;
int main()
{
int dd,dr,q,r;
cout<<"\t Quotient and Remainder Calculator "<<endl;
cout<<"\n";
cout<<"Enter the value of Dividend "<<endl;
cin>>dd;
cout<<"Enter the value of Divisor "<<endl;
cin>>dr;
q=dd/dr;
r=dd%dr;
cout<<"Quotient is "<<q<<endl;
cout<<"Remainder is "<<r<<endl;
}
Write a program to calculate the simple interest. It inputs principal amount, rate of interest and the number of years and display the simple interest.
Programming Skills
March 14, 2019
Write a program to calculate the simple interest. It inputs principal amount, rate of interest and the number of years and display the simple interest.
#include<iostream>
using namespace std;
int main()
{
float p,i,t,x;
cout<<"\t Simple Interest Calculator "<<endl;
cout<<"\n";
cout<<"Enter the principal amount "<<endl;
cin>>p;
cout<<"Enter the Rate of Interest "<<endl;
cin>>i;
cout<<"Enter the number of years "<<endl;
cin>>t;
x=(p+i+t)/100;
cout<<"Simple interest is "<<x<<endl;
}
Write a program to calculate and print the area of a square with given height and width .
Programming Skills
March 14, 2019
Write a program to calculate and print the area of a square with given height and width .
#include<iostream>
using namespace std;
int main()
{
int a,h,w;
cout<<"\t * Area of Square * "<<endl;
cout<<"\n";
cout<<"Enter the Height of Square "<<endl;
cin>>h;
cout<<"Enter the Width of Square "<<endl;
cin>>w;
a=w*h;
cout<<"Area of Square is "<<a<<endl;
}
Write a program that adds two floating point numbers and shows the sum on screen
Programming Skills
March 13, 2019