Question

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

Write a java program that declares a variable in inches, which holds a length in inches, and assign a value 100 inches. Display the value in feet and inches; for example, 86 inches becomes 7 feet and 2 inches. Print the results of conversion of 100 inches into feet and inches.

Java 11 please

Homework Answers

Answer #1

Here is your program...

import java.util.Scanner;

public class Conversion {

public static void main(String[] args) {

double inches = 100;
  
int value = (int)(inches / 12);
  
int value1 = (int)(inches % 12);
  
System.out.println(value + " Feet and " + value1 + " inches");
  
}
}

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
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.
Using Java, given 2 numbers which are the measurement of a distance in feet and inches,...
Using Java, given 2 numbers which are the measurement of a distance in feet and inches, for example 3 feet 7 inches. Change the measurement to meters and centimeters, and display message “? feet ? inches = ? meters and ? centimeters”. The ? should be replaced by real numbers. (1 inch = 2.54 centimeter, 1 foot = 12 inches)
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 program in c++ to Convert an array of inches to an array of centimeters....
Write a program in c++ to Convert an array of inches to an array of centimeters. The program should contain a function called inchesTOcm with three parameters (inches array that contains the values in inches, cm array to save the result in, and an integer variable that defines the length of the array). In the main function: 1. Define an array (inches) of length 3. 2. Initialize the array by asking the user to input the values of its elements....
write a C program that declares an integer variable called "favorite_number". The program should then prompt...
write a C program that declares an integer variable called "favorite_number". The program should then prompt the user to enter their favorite number, and use scanf to read the user's input into favorite_number. Finally, the program should print a message that includes the user's input.
In Java. Write a program that reads-in a times table-number. The program, using this table-number will...
In Java. Write a program that reads-in a times table-number. The program, using this table-number will produce the following report (as shown). The first item in the report is a number with starting value 1. Second column is the word “ X ” (representing the times symbol). Third column is the table-number (itself). Following is an equal sign “ = “ (representing a result). Last column is the result of the operation for that line or row which is the...
1. How many times the loop below will be executed? What is the value of variable...
1. How many times the loop below will be executed? What is the value of variable counter after the loop? counter = 1 while counter < 7: counter+=2 print(counter) 2. An integer is stored in a variable MyInt. Write the Python if statement to test if MyInt is even number or odd number, and print a message to show “It is even number.” or “It is an odd number”. 3. Complete the python below that asks user to enter the...
1. Write a Java program to count the letters, spaces, numbers and other characters of an...
1. Write a Java program to count the letters, spaces, numbers and other characters of an input string. 2. Write a Java program to print numbers between 1 to 100 which are divisible by 3, 5 and by both 3. Write a Java program to convert a given string into lowercase
Call your project as CarpetCost Write a Java to calculate the cost of installing carpeting into...
Call your project as CarpetCost Write a Java to calculate the cost of installing carpeting into a new room. Your program should ask the user to enter a value for the room width (in metres), the room length (in metres) and then calculate and print the cost of the carpeting, the cost of installation, the taxes to be paid (PST (8%) , GST (7%)) and the final overall cost. The carpet cost is $24.95 per square yard and the installation...
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)...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT