Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help for the assignment below ANALYZATION ASSIGNMENT INSTRUSTIONS BELOW:

ID: 3854904 • Letter: I

Question

I need help for the assignment below

ANALYZATION ASSIGNMENT INSTRUSTIONS BELOW:

OK, so This time there is a twist to the analyzation. You've seen the problem with it so do your best to talk about it also.You will post your analyzation thru the discussion forum in each module, you will perform a detailed analysis of the differences and similarities between:

1. M1 SOLUTION and M3 SOLUTION

2. M2 SOLUTION and M3 SOLUTION below

These should be detailed enough to discuss logic and syntax but not so detailed that you talk about variable names and such.

M1 SOLUTION

#include <iostream>

#include <conio.h>

using namespace std;

int menu();

class weightType

{

public:

       void ConvertLBS();

       void SetLBS(double);

       void PrintKG();

       weightType();

private:

       double LBS, KG;

};

class heightType

{

public:

       void ConvertHeight();

       void SetFeetInches(double, double);

       void PrintHeight();

       heightType();

private:

       double CM, Feet, Inches;

};

void main()

{

       int choice;

      

       choice = menu();

       while (choice == 1 || choice == 2)

       {

              if (choice == 1)

              {

                     double lbs;

                     weightType CurrentSession;

                     cout << " enter the pounds to convert :" << flush;

                     cin >> lbs;

                     CurrentSession.SetLBS(lbs);

                     CurrentSession.ConvertLBS();

                     CurrentSession.PrintKG();

              }

              else

              {

                     double FT, IN;

                     heightType CurrentSession;

                     cout << " Enter the feet : " << flush;

                     cin >> FT;

                     cout << " Enter the inches : " << flush;

                     cin >> IN;

                          

                     CurrentSession.SetFeetInches(FT, IN);

                     CurrentSession.ConvertHeight();

                     CurrentSession.PrintHeight();

              }

              cout << "press anyKey to continue..." << flush;

              _getch();

              cout << endl;

              choice = menu();

       }

} // End of main

void weightType::ConvertLBS()

{

       KG = LBS * 0.45359;

}

void weightType::SetLBS(double pounds)

{

       LBS = pounds;

}

void weightType::PrintKG()

{

       cout << " Pounds entered : " << LBS << " and Kilograms are : " << KG << endl << endl;

}

weightType::weightType()

{

       LBS = 0;

       KG = 0;

}

void heightType::ConvertHeight()

{

       CM = (Feet * 30.48) + (Inches * 2.54);

}

void heightType::SetFeetInches(double feet, double inches)

{

       Feet = feet;

       if (inches < 12)

              Inches = inches;

       else

              Inches = 0;

}

void heightType::PrintHeight()

{

       cout << " feet entered : " << Feet << " and inches entered : "

              << Inches << " So Centimeters are : " << CM << endl << endl;

}

heightType::heightType()

{

       CM = 0;

       Feet = 0;

       Inches = 0;

}

int menu()

{

       int entry;

       static bool firstTime = true;

       do

       {

              system("cls");

              cout << " Conversion Program " << endl

                     << " 1. to convert weight" << endl

                     << " 2. to convert height" << endl;

              if (!firstTime)

                     cout << " 3. to Exit" << endl;

              cout << endl << "enter choice here : " << flush;

              cin >> entry;

       }while (entry != 1 && entry != 2 && entry != 3);

       firstTime = false;

       return entry;

}

M2 SOLUTION

#include <iostream>

#include <conio.h>

#include "M4_Weight.h"

#include "M4_Height.h"

using namespace std;

int menu();

void main()

{

       int choice;

      

       choice = menu();

       while (choice == 1 || choice == 2)

       {

              if (choice == 1)

              {

                     double lbs;

                     weightType CurrentSession;

                     cout << " enter the pounds to convert :" << flush;

                     cin >> lbs;

                     CurrentSession.SetLBS(lbs);

                     CurrentSession.ConvertLBS();

                     CurrentSession.PrintKG();

              }

              else

              {

                     double FT, IN;

                     heightType CurrentSession;

                     cout << " Enter the feet : " << flush;

                     cin >> FT;

                     cout << " Enter the inches : " << flush;

                     cin >> IN;

                          

                     CurrentSession.SetFeetInches(FT, IN);

                     CurrentSession.ConvertHeight();

                     CurrentSession.PrintHeight();

              }

              cout << "press anyKey to continue..." << flush;

              _getch();

              cout << endl;

              choice = menu();

       }

} // End of main

int menu()

{

       int entry;

       static bool firstTime = true;

       do

       {

              system("cls");

              cout << " Conversion Program " << endl

                     << " 1. to convert weight" << endl

                     << " 2. to convert height" << endl;

              if (!firstTime)

                     cout << " 3. to Exit" << endl;

              cout << endl << "enter choice here : " << flush;

              cin >> entry;

       }while (entry != 1 && entry != 2 && entry != 3);

       firstTime = false;

       return entry;

}

M3 SOLUTION

#include "stdafx.h"

#include <iostream>

using namespace std;

void Convert(int inch)

{

       int feet, inches;

       inches = inch % 12;

       feet = inch/12;

       cout << " The height in feet is" << feet << "" << inches << "" " << endl;

}

int main()

{

       int htInches;

       cout << " Enter height in iches";

       cin >> htInches;

       Convert(htInches);

       cout << " ";

       return 0;

}

Explanation / Answer

Differences M1 and M3:-
M1:
Here the functions(ConvertLBS(), SetLBS(double), PrintKG(), ConvertHeight(), SetFeetInches(double, double), PrintHeight()) present are of class type.

It has components of polymorphim
weightType CurrentSession || heightType CurrentSession

It has classes.

Logically it deals with values of heights and weights.

The main function is of type 'void' so no return is needed.

There are choices of selecting which all functions to follow and what not.

Can be done executed in console due to #include <conio.h> present.

M3:
Here the functions(ConvertLBS(), SetLBS(double), PrintKG(), ConvertHeight(), SetFeetInches(double, double), PrintHeight()) are not present.

No components of polymorphim as such.

It has a precompiled header (because it must be directly or indirectly included through another normal header, before any compilable code).

Logically it deals with the values of heights only.

The main function is of type 'int' so return is needed.

There are 'no' choices of selecting which all functions to follow and what not.We have to move with specified options.

Cannot be done executed in console due to #include <conio.h> absent.

Similarities M1 and M3:-
M1 and M3 follows the concepts of OOPs.

-----------------------------------------------------------------------

Differences M2 and M3:-
M2:
Can be done executed in console due to #include <conio.h> present.

There are choices of selecting which all functions to follow and what not.

It uses header M4_Weight.h that probably has informations about the functions and classes(weightType, heightType) mentioned in main function.

Logically it deals with values of heights and weights.

It has components of polymorphim
weightType CurrentSession || heightType CurrentSession

Here function('menu') has its signature and definition seperately.

The main function is of type 'void' so no return is needed.
M3:
Cannot be done executed in console due to #include <conio.h> absent.

There are 'no' choices of selecting which all functions to follow and what not.We have to move with specified options.

It uses header stdafx.h. Its a precompiled header (because it must be directly or indirectly included through another normal header, before any compilable code).This header is generated by Microsoft Visual Studio IDE wizards, that describes both standard system and project specific include files that are used frequently but hardly ever change.

Logically it deals with the values of heights only.

No components of polymorphim as such.

Here function('Convert') has no distinguished signature and definition seperately.Hence present before main function.

The main function is of type 'int' so return is needed.

Similarities M2 and M3:-
M2 and M3 follows the concepts of OOPs.
Both has distinguished headers a per requirement.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote