On Microsoft VIsual Studio C++
need it in a C++ code that works also use the way that starts with hello world
This program creates the basic user interface code that can be used in the following week’s iLab assignments. The assignment will help you get started using the programming environment and some practice with coding. You will also be able to reuse much, if not all, of the code in later assignments.
In this program, you will create the following methods:
DisplayApplicationInformation, which will provide the program user some basic information about the program.
DisplayDivider, which will provide a meaningful output separator between different sections of the program output.
GetInput, which is a generalized function that will prompt the user for a specific type of information, then return the string representation of the user input.
TerminateApplication, which provides a program termination message and then terminates the application.
Using these methods, you will construct a program that prompts the user for the following:
your name, which will be a string data type;
your age, which will be an integer data type;
the gas mileage for your car, which will be a double data type; and
a display of the collected information.
Also, note that the program should contain a well-documented program header.
S247 Week 1 Lab, Design
Program Description: Basic User Interface
This program creates the basic user interface code that can be used in the following week’s iLab assignments. The assignment will help you get started using the programming environment and some practice with coding. You will also be able to re-use much, if not all, of the code in later assignments.
In this program, you will create the following methods:
1. DisplayApplicationInformation, which will provide the program user some basic information about the program.
2. DisplayDivider, which will provide a meaningful output separator between different sections of the program output.
3. GetInput, which is a generalized function that will prompt the user for a specific type of information, then return the string representation of the user input.
4. TerminateApplication, which provides a program termination message and then terminates the application.
Using these methods, you will construct a program that prompts the user for the following:
1. Your name, which will be a string data type 2. Your age, which will be an integer data type 3. The gas mileage for your car, which will be a double data type 4. Display the collected information
Also, note that the program should contain a well document program header.
Pseudocode
//Program Header //Program Name: Basic User Interface //Programmer: Your Name //CIS247, Week 1 Lab //Program Description: PROVIDE A DESCRIPTITON OF THE PROGRAM
Start main
//declare variables input as string name as string age as integer mileage as double
call DisplayApplicationInformation call DisplayDivider(“Start Program”)
call DisplayDivider(“Get Name”) set name = GetInput(“Your Name”) display “Your name is: “ + name
call DisplayDivider(“Get Age”) set input = GetInput(“Your Age”) set age = convert input to integer display “Your age is: “ + age
call DisplayDivider(“Get Mileage”) set input = GetInput(“Gas Mileage”)
set mileage = convert input to double //display mileage to 2 decimal places display “Your car MPG is: “ + mileage
call TerminateApplication
end main program
procedure DisplayApplicationInformation
display “Welcome the Basic User Interface Program” display “CIS247, Week 1 Lab” display “Name: YOUR NAME” display “This program accepts user input as a string, then makes the appropriate data conversion”
end procedure
procedure DisplayDivider(string outputTitle)
display “**************** “ + outputTitle + “****************”
end procedure
function GetInput(string inputType) as string
strInput as string
display “Enter the “ + inputType get strInput
return strInput
end function
procedure TerminateApplication
display “Thank you for using the Basic User Interface program” exit application
end procedure
Capture the results of each test and paste them into a Word document. Below is a sample program output.
Expert Answer
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cstring>
using namespace std;
char name[256];
int age;
double mileage;
void DisplayApplicationInformation();
void DisplayDivider(string a);
void TerminateApplication();
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
DisplayApplicationInformation();
DisplayDivider(“Start Program”);
DisplayDivider(“Get Name”);
DisplayDivider(“Get Age”);
DisplayDivider(“Get Mileage”);
TerminateApplication();
return 0;
}
void DisplayApplicationInformation(){
// DisplayDivider(“Start Program”);
cout<<“Welcome to the Basic User Interface Program”<<endl;
cout<<“CIS247, Week 1 Lab”<<endl;
cout<<“Name: Your Name”<<endl;
cout<<“This program accepts user input as a string, then makes the appropriate data conversion.”<<endl;
}
void DisplayDivider(string a){
cout <<“**************** “<<a<<” ****************”<<endl;
if(a==”Get Name”){
cout<<“Please enter your name: “;
cin.getline(name,256);
cout<<“Your name is: “<<name<<endl;
}else if(a==”Get Age”){
cout<<“Please enter your age: “;
cin>>age;
cout<<“Your age is: “<<age<<endl;
}else if(a==”Get Mileage”){
cout<<“Enter your mileage: “;
cin>>mileage;
cout<<“Your car MPG is: “<<mileage<<endl;
}
}
void TerminateApplication(){
cout<<“Thank you for using the Basic User Interface program”<<endl;
}
ScreenShot of the code: