Exercise 1. Read the program and answer the following questions before you run the program. a). How many lines of input does program Frame1 expect? b). What happens if you key both values on the same line with a blank between them? c). What happens if you key both values on the same line without a blank between them?

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 4GZ
icon
Related questions
Question
100%
Can anyone help me with this question. I’ve been stuck on these exercises
Open Microsoft Visual Studio, create a new project called Frame1(use the same configuration as lab #1).
Enter the following program to your project as Frame1.cpp. Use this program for exercises 1-3.
// Program Framelprompts the user to input values representing
// the dimensions of a print. The amount of wood needed for
// the frame is calculated and printed on the screen.
#include <iostream>
Using namespace std;
int main()
{
int side;
int top;
int inchesOfWood;
// Vertical dimension in inches
// Horizontal dimension in inches
// Inches of wood needed
cout << "Enter the vertical dimension of your print."
<« endl;
cout << "The dimension should be in whole inches. "
<< "Press return." « endl;
cin >> side;
cout << "Enter the horizontal dimension of your print."
<< endl;
cout << "The dimension should be in whole inches. "
<< "Press return." « endl;
cin >> top;
inchesOfWood = top + top + side + side;
cout << "You need "
<< inches0fWood
くく "
inches of wood." << endl;
return 0;
}
Exercise 1.
Read the program and answer the following questions before you run the program.
a). How many lines of input does program Frame1 expect?
b). What happens if you key both values on the same line with a blank between them?
c). What happens if you key both values on the same line without a blank between them?
Transcribed Image Text:Open Microsoft Visual Studio, create a new project called Frame1(use the same configuration as lab #1). Enter the following program to your project as Frame1.cpp. Use this program for exercises 1-3. // Program Framelprompts the user to input values representing // the dimensions of a print. The amount of wood needed for // the frame is calculated and printed on the screen. #include <iostream> Using namespace std; int main() { int side; int top; int inchesOfWood; // Vertical dimension in inches // Horizontal dimension in inches // Inches of wood needed cout << "Enter the vertical dimension of your print." <« endl; cout << "The dimension should be in whole inches. " << "Press return." « endl; cin >> side; cout << "Enter the horizontal dimension of your print." << endl; cout << "The dimension should be in whole inches. " << "Press return." « endl; cin >> top; inchesOfWood = top + top + side + side; cout << "You need " << inches0fWood くく " inches of wood." << endl; return 0; } Exercise 1. Read the program and answer the following questions before you run the program. a). How many lines of input does program Frame1 expect? b). What happens if you key both values on the same line with a blank between them? c). What happens if you key both values on the same line without a blank between them?
Exercise 2.
Compile and run the program. Verify your answers in Exercise 1. Show your results
Exercise 3.
Key in floating-point values as side and top of the print. What happens? Make changes in the program
Frame1 such that you can key in floating-point values and get a correct result that is displayed as a floating-
point value. Make sure to update the prompts accordingly. Include your code and testing results
Transcribed Image Text:Exercise 2. Compile and run the program. Verify your answers in Exercise 1. Show your results Exercise 3. Key in floating-point values as side and top of the print. What happens? Make changes in the program Frame1 such that you can key in floating-point values and get a correct result that is displayed as a floating- point value. Make sure to update the prompts accordingly. Include your code and testing results
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,