Question

Write a program that declares a variable named inches, which holds a length in inches, and...

Write a program that declares a variable named inches, which holds a length in inches, and assign a value. Display the value in feet and inches; for example: 86 inches is 7 feet and 2 inches. Be sure to use a named constant where appropriate.

When submitting the program for testing/grading, assign the value 86 to inches.

Homework Answers

Answer #1


#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
int inches=86;
int feet=inches/12;
int inch=inches-(feet*12);
cout<<inches<<" inches\n";
cout<<feet<<" feet "<<inch<<" inches";

return 0;
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Java Using NetBean Write a program to define an integer variable named as roomNumber. Assign 408...
Java Using NetBean Write a program to define an integer variable named as roomNumber. Assign 408 to the variable. Then display a message in System.out as “The programming class is in room ”+roomNumber.
Write a Python program named lastNameVolumes that finds the volumes of different 3 D objects such...
Write a Python program named lastNameVolumes that finds the volumes of different 3 D objects such as a cube, sphere, cylinder and cone. In this file there should be four methods defined. Write a method named cubeVolFirstName, which accepts the side of a cube in inches as an argument into the function. The method should calculate the volume of a cube in cubic inches and return the volume. The formula for calculating the volume of a cube is given below....
Write a program named CheckZips that is used by a package delivery service to check delivery...
Write a program named CheckZips that is used by a package delivery service to check delivery areas. The program contains an array that holds the 10 zip codes of areas to which the company makes deliveries. (Note that this array is created for you and does not need to be changed.) Prompt a user to enter a zip code, and display a message indicating whether the zip code is in the company’s delivery area. For example if the user enters...
Lab: RectClass (constructor) Code in C++ This program creates a Rectangle object, then displays the rectangle's...
Lab: RectClass (constructor) Code in C++ This program creates a Rectangle object, then displays the rectangle's length, width, and area Define an overloaded constructor and use it when creating the Rectangle object instead of using the setters. Change this program to calculate and display the rectangle's perimeter. Example: In feet, how wide is your house? 20 In feet, how long is your house? 25 The house is 20.00 feet wide. The house is 25.00 feet long. The house has 500.00...
Phone number lookup Design a program that has two parallel arrays: a string array named people...
Phone number lookup Design a program that has two parallel arrays: a string array named people that is initialized with the names of seven of your friends, and a string array named phoneNumbers that is initialized with your friends phone numbers. The program should allow the user to enter a persons name (or part of a persons name). it should then search for that person in the people array. If the person is found, it should get that persons phjone...
1) Write a java programming using a while loop where you will add numbers and when...
1) Write a java programming using a while loop where you will add numbers and when you press number 0 it will add all your numbers and display the results. Use Scanner object. Steps: 1) Declare variables integer called sum which is equal to zero   2) Declare Scanner object   3) Declare while condition where is true   4) Inside of that condition prompt the user to enter the numbers   5) Declare variable integer called number and input the number statement   6)...
Design a Java class named Polygon that contains:  A private int data field named numSides...
Design a Java class named Polygon that contains:  A private int data field named numSides that defines the number of sides of the polygon. The default value should be 4.  A private double data field named sideLength that defines the length of each side. The default value should be 5.0.  A private double data field named xCoord that defines the x-coordinate of the center of the polygon. The default value should be 0.0.  A private double...
I am using Oracle HR. Write a query to display the last name of employees, length...
I am using Oracle HR. Write a query to display the last name of employees, length of the name, and first monday since the hire date. Make the query that the user is prompted to enter a letter that the last name start with by using a substitution variable for the letter. For example, if the user enters "H" or "h" when prompted, the output should show all employees whose start with letter H and make sure that the case...
Problem a (LA2a.java) Write a program to compute the area, perimeter, and interior angle of a...
Problem a (LA2a.java) Write a program to compute the area, perimeter, and interior angle of a regular polygon. First, have the user supply the number of sides of the polygon (a whole number, which must be 3 or greater) and the side length (any positive number). Then, compute the area via the following equation: where n is the number of sides and s is the side length. Note that the equations are equivalent, with the first using degrees and the...
In this lab, you complete a partially prewritten C++ program that uses an array. The program...
In this lab, you complete a partially prewritten C++ program that uses an array. The program prompts the user to interactively enter eight batting averages, which the program stores in an array. The program should then find the minimum and maximum batting average stored in the array as well as the average of the eight batting averages. The data file provided for this lab includes the input statement and some variable declarations. Comments are included in the file to help...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT