Write a program that converts and prints a user-supplied measurement in inches i
ID: 3724048 • Letter: W
Question
Write a program that converts and prints a user-supplied measurement in inches into foot (12 inches) yard (36 inches), centimeter (2.54 inches) and meter (39.37 inches). Screen sample (bold is user input). 1. *Inch Conversion Program** Please enter how many inches you want to convert: 69 That is 5.75 feet 1.92 yard 175.26 centimeter 1.75 meter Write a program that reads a product type (a character), the quantity sold (an integer) and the dollar amount (a double). Use setw & setfill. 2. Please enter the product type, quantity sold and price: F 10 210.50 Thank you. You entered: Type: F Qty: 10 Price: $***210.50 Write a program segment that will ask the user to input a number and it will display the square and cube of the number. The space between' and the number should be 10 blank spaces filled with dashes (-). Use setw & setfill. 3. Please enter a number: 5 The square of the number is..-25 The cube of the number is 125Explanation / Answer
Question 1
#include <iostream>
using namespace std;
int main() {
// your code goes here
int inch;
cout<<"*** Inch Conversion Program *** ";
cout<<"Please enter how many inches you want to convert:";
cin>>inch;
cout<<" ";
cout<<"That is ";
cout<<0.0833333* inch<<" feet";
cout<<" "<<0.0277778* inch<<" yard";
cout<<" "<<2.54* inch<<" centimeter";
cout<<" "<<0.0254* inch<<" meter";
cout<<" ";
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
Question 2
int main() {
// your code goes here
char pt;
int qs;
double price;
cout<<"Please enter the product type, quantity sold and price: ";
cin>>pt>>qs>>price;
cout<<" ";
cout<<"Thank you.You entered:";
cout<<"Type: "<<pt<<" Qty: "<<qs<<" Price:$";
std::cout << std::fixed;
std::cout << std::setprecision(2);
std::cout << std::setfill ('*') << std::setw (9);
std::cout <<price<< std::endl;
return 0;
}
Question 3
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
// your code goes here
int num;
cout<<"Please enter a number:";
cin>>num;
cout<<" ";
cout<<"The square of the number is:";
std::cout << std::setfill ('-') << std::setw (12);
cout<<num*num<<" ";
cout<<"The cube of the number is:";
std::cout << std::setfill ('-') << std::setw (12);
cout<<num*num*num<<" ";
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.