Computers and Technology

Write a program that declares constants to represent the number of inches, feet, and yards in a mile. Name the constants INCHES_IN_MILE, FEET_IN_MILE, and YARDS_IN_MILE respectively. Also declare a variable named miles to represent a number of miles. Compute and display, with explanatory text, the value in inches, feet, and yards—for example: 4.0 miles is 253440.0 inches, or 21120.0 feet, or 7040.0 yards.

This is what I have but it is only 50% correct:

import java. util. Scanner;
class MileConversions
{
public static void main(String[] args)
{
final double INCHES_IN_MILE = 63360.0;
final double FEET_IN_MILE = 5280.0;
final double YARDS_IN_MILE = 1760.0;
double miles = 4.0;

Scanner scanner = new Scanner(System. in);
System. out. print("Enter miles: ");
miles = scanner. nextDouble();

System. out. printf("%.1f miles is %.1f inches, or %.1f feet, or %.1f yards", miles, miles*INCHES_IN_MILE, miles*FEET_IN_MILE, miles*YARDS_IN_MILE);

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 19:40, Dogtes9667
Consider the following generator matrix: g= (1 0 0 0 1 0 0 0 1 1 1 1 1 0 1 1 1 0) find all the codewords generated by this generator matrix. determine the number of errors that this code will detect. determine the number of errors that this code will correct. prove that a linear code's minimum weight is equivalent to its minimum distance. that is, where c is a linear code, dist(c) = wh(c)
Answers: 1
image
Computers and Technology, 24.06.2019 02:20, Jonny13Diaz
The first time a user launches the powerpoint program, which view is shown allowing the user to access recent presentations or create new presentations based on templates?
Answers: 1
image
Computers and Technology, 24.06.2019 06:30, meganwintergirl
Ineed to know the anwser to all these questions
Answers: 2
image
Computers and Technology, 24.06.2019 18:30, brendahndz8676
Is a type of bullying that takes place when a person intentionally posts negative information about another person that is not true.
Answers: 2
Do you know the correct answer?
Write a program that declares constants to represent the number of inches, feet, and yards in a mile...

Questions in other subjects:

Konu
English, 03.11.2020 21:20
Konu
Health, 03.11.2020 21:20
Konu
Mathematics, 03.11.2020 21:20