C++ Answers

Questions answered by Experts: 9 913

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Declare the class E-Bill consisting of data members cust_no, name, st_reading, end_reading, tot_usage and amount to find total energy usage and amount per unit of electric energy. The parameterized constructor are used to initialize object of class E-Bill, then find the total energy usage and amount per unit of electric energy and display the information of E-Bill electric energy. Finally free the resources of data objects using destructor member function. (Note: Amount per unit is Rs. 5.50)

Previous lesson displays static information. In this lesson we are going to use the dynamic display of information. #include <iostream> using namespace std; int main(){ //we declare data types here. string name; //fist we need to display the Instruction for the user."Enter your name: cout<<"Enter your name: //we call the "name" variable to get the user input. we use "cin" to get the user input cin>>name; //we call again our variable name to display what the user input. cout<<"Your name is: "<<name; //try it and try to complete the personal information. add the following variables //age, gender, address, email, mobile }


Hello!

I am trying to find how many jelly beans can fit in a jar. so I made some variables.


 double height, diameter, beanLength, beanDiameter, glassThickness, radius, newRadius;

  double volumeOfJar, airCubicInches, trueVolume, jellyBeanVolume;


as show here. But I need to initialize them. so I tried this


 int height;

  int diameter;

  int beanLength; beanLength = 0.625;

  int beanDiameter; beanDiameter = 0.25;

  int glassThickness;

  int radius;

  int newRadius;

  int volumeOfJar;

  int airCubicInches;

  int trueVolume;

  int jellyBeanVolume;


But my program does not like that. How do I fix the varibles to be initialized?



diameter of a cycle wheel is D. Given that, the cycle travels at an average speed of X km/h,

find the number of revolutions made by the wheel per minute, giving your answer to the nearest whole

number (assume PI = 3.142). Write a C++ function to calculate revolutions per minute.


The diameter of a cycle wheel is D. Given that, the cycle travels at an average speed of X km/h,

find the number of revolutions made by the wheel per minute, giving your answer to the nearest whole

number (assume PI = 3.142). Write a C++ function to calculate revolutions per minute.


Creat a class named Rectangle with integer instance variables named width, height, area and perimeter. Override the default constructor and use it to set these variables to zero. Also include another constructor that accepts perimeters for the width and height instance variables and initializes the instance variables area and perimeter to zero.
Include the following accessor and mutator methods;
I) setWidth which accepts a parameter that can be used to assign the width instance variable.
2) setHeight which accepts a parameter that can be used to assign the height instance variable.
3) getArea that returns the value of area instance variable.
4) getPerimeter that returns the value of perimeter instance variable.

Also include following custom methods:
1) computeArea which computes a rectangle's area but doesn't return a value
2) computePerimeter Which computes a rectangle's perimeter and also doesn't return a value.

Assume a file named 

Random.txt

exists, and contains a list of random numbers. Write a program that opens the file, reads all the numbers from the file, and calculates the following:

  • The number of numbers in the file
  • The sum of all the numbers in the file (a running total)
  • The average of all the numbers in the file


The program should display the number of numbers found in the file, the sum of the numbers, and the average of the numbers.

Output Labels:

Print each of the above quantities on a line by itself, preceded by the following (respective) strings: "

Number of numbers: 

", "

Sum of the numbers: 

", and "

Average of the numbers: 

".

Sample Run

Number of numbers: 20

Sum of the numbers: 210

Average of the numbers: 10.5 


Define a structure that represents Fruit with properties fruit name, fruit type, fruit color.
Write a program that accepts data of four fruits and displays the results.

there are 3 member functions.1st one to set value for person discount,distance.second one to display personcount,distance and fair .3rd function to caliculate the fair with assumption that fair for 1 person is 300rupees if distance>=1200km and 200 rs for<500kmand for in between distance it is 350 rupees write c++pgm


Write a program to create a single link list of 5 elements.
LATEST TUTORIALS
APPROVED BY CLIENTS