Question

Java Programming. Please make sure program compiles, the code is copyable, and screenshots of the output are provided for 5 stars :-) Calculation for speed is just supposed to be google searched

1) 18 points] Youve been hired by Pedal Punchers to write a Java console application that estimates bicycle speed in miles per hour. Use a validation loop to prompt for and get from the user the wheel diameter of a bicycle in inches in the range 10-50. Then use a validation loop to prompt for and get from the user the number of rotations the bike wheel makes per pedal rotation in the range 0.1-10. Then use a validation loop to prompt for and get from the user the number of pedal rotations per minute in the range 1-120. Format the following output in two columns with the first column containing a label and the second column containing the result. Format any real numbers to three decimal places The three inputs. o o The estimated speed based on the three inputs Use Math PI in your calculation. Continue to prompt the user for estimates until they enter n. Use this data for the last three inputs Wheel diameter Wheel-to-pedal ratio Pedal rotations per minute 24 34 27 2.5 40 30 10 17

0 0
Add a comment Improve this question Transcribed image text
Answer #1

dia[il val; set=false; else System.out.print (\nNot valid. \nTry again.\n); set-true; while (set) System.out.print (\nEnteelse System. out.print (n nNot valid.\nTry again.\n) set-true; for (int c-l c<n c++) speed[c] (float) (((dia [c]* foot_to_mProgram code:

import java.util.*;

public class SpeedCalc

{

    private static final double foot_to_miles = 0.000189394;

   private static final double inch_to_foot = 0.0833333;

public static void main(String []args)

{

Scanner s = new Scanner(System.in);

float[] dia = new float[10];

float[] ratio = new float[10];

float[] rotation = new float[10];

float[] speed = new float[10];

int n,i=1;

boolean set=true;

System.out.print("Enter n: ");

n=s.nextInt();

while(i<=n)

{

    while(set)

    {

      System.out.print("\nEnter the value of Wheel diameter : ");

      float val = s.nextFloat();

      if (val>=10 && val<=50)

      {

        dia[i] = val;

        set=false;

      }

    else

       System.out.print("\nNot valid.\nTry again.\n");

    }

    set=true;

    while(set)

    {

        System.out.print("\nEnter the value of Bike-to-pedal ratio : ");

        float val = s.nextFloat();

        if (val>=0.1 && val<=10)

        {

            ratio[i] = val;

            set=false;

        }

        else

            System.out.print("\n nNot valid.\nTry again.\n");

    }

    set=true;

    while(set)

    {

         System.out.print("\nEnter the value of Pedal rotations per minute : ");

         float val = s.nextFloat();

         if (val>=1 && val<=120)

         {

           rotation[i] = val;

           set=false;

         }

         else

             System.out.print("\n nNot valid.\nTry again.\n");

    }

    set=true;

    i=i+1;

}

for(int c=1; c<=n; c++)

{

speed[c] = (float) (((dia[c]*foot_to_miles)*inch_to_foot*Math.PI)*ratio[c]*rotation[c]*60);

}

System.out.println(" \nWheel diameter Bike-to-pedal ratio Pedal Rotations per minute   speed");

for(int k=1; k<=n; k++)

{

System.out.println("\t"+dia[k]+"\t\t"+ratio[k]+"\t\t"+rotation[k]+"\t\t\t"+speed[k] );

}

}

}

Add a comment
Know the answer?
Add Answer to:
Java Programming. Please make sure program compiles, the code is copyable, and screenshots of the output...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please make a JAVA program for the following using switch structures Write a program that simulates...

    Please make a JAVA program for the following using switch structures Write a program that simulates a simple Calculator program. The program will display menu choices to the user to Add, Subtract, Multiply and Divide. The program will prompt the user to make a selection from the choices and get their choice into the program. The program will use a nested if….else (selection control structure) to determine the user’s menu choice. Prompt the user to enter two numbers, perform the...

  • Java BasketBall Bar Chart Write a program that allows you to create a bar chart for...

    Java BasketBall Bar Chart Write a program that allows you to create a bar chart for the active members of a basketball team during a game. (Recall: there are only 5 active players on the court per team in a standard basketball game.) Your program should do the following tasks: 1) Prompt the user to store the first name of the five players 2) Prompt the user to enter the points scored by each player a. Use a do...while loop...

  • C++ Assignment 4 - Robot Speed Estimator Be sure to read through Chapter 7 Structured Data...

    C++ Assignment 4 - Robot Speed Estimator Be sure to read through Chapter 7 Structured Data and Classes before starting this assignment. Your job is to write a program to estimate the speed of a robot. Your program will use a class called Robot to represent a robot. To keep things simple, this class will focus only on one aspect of a Robot - the maximum speed at which it can move. Background The speed of the robot is largely...

  • MAKE SURE YOU TEST THE PROGRAM FISRT. DON'T PUT THE CODE WITHOUT TESTING. MAKE SURE ALL...

    MAKE SURE YOU TEST THE PROGRAM FISRT. DON'T PUT THE CODE WITHOUT TESTING. MAKE SURE ALL THE STEPS ARE FOLLOWED IN CORRECT MANNER ONLY USE VISUAL STUDIO C# CONSOLE APPLICATION Use File IO (NO JAVA CODING) Create a C# Console program that will demonstrate the use of File IO, Arrays, and Classes. This assignment has a number of requirements. Carefully read the document and note all the requirements. Also keep in mind that many of the requirements for this assignment...

  • please put the comment each line, make sure i will have output too. write a program,...

    please put the comment each line, make sure i will have output too. write a program, Summarize (Summarize.java), containing the main() method, that first writes 10,000 random positive double type numbers, to the full accuracy of the number (15/16 decimal places), to a text file named DataValues.txt, one number per line. The program must then close that file, and reopen it for reading. Read back the values from the file and write the following information to a file named Summary.txt:...

  • Please help with Java programming! This code is to implement a Clock class. Use my beginning...

    Please help with Java programming! This code is to implement a Clock class. Use my beginning code below to test your implementation. public class Clock { // Declare your fields here /** * The constructor builds a Clock object and sets time to 00:00 * and the alarm to 00:00, also. * */ public Clock() { setHr(0); setMin(0); setAlarmHr(0); setAlarmMin(0); } /** * setHr() will validate and set the value of the hr field * for the clock. * *...

  • In JAVA Chapter 5Assignment(Rock, Paper, Scissors)–20pointsYour goal is towrite a program that lets the user play...

    In JAVA Chapter 5Assignment(Rock, Paper, Scissors)–20pointsYour goal is towrite a program that lets the user play the game of Rock, Paper, Scissors against the computer.Your program should have the following: •Make the name of the project RockPaperScissors•Write a method that generates a random number in the range of 1 through 3. The randomly generated number will determine if the computer chooses rock, paper, or scissors. If the number is 1, then the computer has chosen rock. If the number is...

  • PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program tha...

    PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program that reads a values for hour and minute from the input test file timeData.txt . The data read for valid hour and valid minute entries. Assume you are working with a 24 hour time format. Your program should use functions called validateHour and validateMinutes. Below is a sample of the format to use for your output file  timeValidation.txt :   ...

  • Java Project In Brief... For this Java project, you will create a Java program for a...

    Java Project In Brief... For this Java project, you will create a Java program for a school. The purpose is to create a report containing one or more classrooms. For each classroom, the report will contain: I need a code that works, runs and the packages are working as well The room number of the classroom. The teacher and the subject assigned to the classroom. A list of students assigned to the classroom including their student id and final grade....

  • Please can someone help me to finish this program? It is a C programming not a...

    Please can someone help me to finish this program? It is a C programming not a C++, when programming the program in linux I keep getting expected expression before || token, also please check if everything else is fine, maybe there is something else worng in my program and may ask me later to fix it, I am concern about the sin and cosine. The program is supposed to do all this: 1.Display a welcome message. 2.Prompt for the height...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT