Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 amount

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

ISBN: 1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

=+6 Who is the peer of the IA ?

Answered: 1 week ago

Question

=+herself to in terms of equity with regard to this assignment?

Answered: 1 week ago

Question

=+ What typical employee will the IA compare him/

Answered: 1 week ago