Question
Need help on C++ homework. Thanks Need help updating code from last assignment to this assignment above. Here is the code to update below from
Need help on C++ homework. Thanks
Need help updating code from last assignment to this assignment above.
Here is the code to update below from last assignment.
------------------------------------------------
Main.cpp
#include
#include "Weight_Conversion.cpp" //include file
using namespace std ;
int main(){
double userInput;
Weight w;
cout
cin >> userInput;
if(userInput
cout
}
else
w.setEarthweight(userInput);
int userselection;
do{
cout
cout
cout
cout
cout
cout
cout
cout
cout
cout
cout
cin >> userselection;
switch(userselection){
case(1):
cout
break;
case(2):
cout
break;
case(3):
cout
break;
case(4):
cout
break;
case(5):
cout
case(6):
break;
cout
default:
cout
}
} while(userselection!=6);
return 0;
}
-----------------------------------
Weight_Conversion.cpp
#include
class Weight{
double earthweight;
public:
//Constructor
Weight(){
earthweight= 100;
}
void setEarthweight(double weight){
earthweight=weight;
}
double getEarthweight(){
return earthweight;
}
double mercury(double oWeight){
if(oWeight
oWeight=earthweight;
return oWeight * 0.38;
}
double venus(double oWeight){
if(oWeight
oWeight=earthweight;
return oWeight *0.91;
}
double mars(double oWeight){
if(oWeight
oWeight=earthweight;
return oWeight *0.38;
}
double moon(double oWeight){
if(oWeight
oWeight=earthweight;
return oWeight *0.17;
} };
Add a derived class that will calculate weight conversions to kilograms to Weight_Conversion.cpp The class will have methods that will convert user input in pounds to kilograms. Update Program with two files main.cpp Weight_Conversion.cpp Use a class constructor to initialize class values for weight to 100 pounds. Program should let the user know the execution is with a default value for the program. Output all the weight conversions with the default value if the user enters an amountStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started