Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi guys! I need help making a java program. Create a class that calculates gear

ID: 3616865 • Letter: H

Question

Hi guys! I need help making a java program. Create a class that calculates gear ratios for a bicycle. You must use two constructors as in the examples above. You are given the following data: Tire size diameter is 26 Front Chainwheel has 30 teeth Rear Sprocket has 90 teeth Calculate and return gear ratio using the formula: of teeth front chainwheel / # of teeth rear sprocket X wheel diameter Afterwards, create a different program that will instead have the program accept any values from the user through a demo class. However, the FIRST values tested MUST be 22 front teeth and 30 rear teeth.

Explanation / Answer

please rate - thanks public class BicycleTest { public static void main( String[] args ) { int tire=26,front=30,rear=90; Bicycle bike=new Bicycle(front,rear,tire); System.out.printf("front teeth= %d rear teeth = %d gear ratio=%f ", bike.getFront(),bike.getRear( ),bike.getRatio()); } } ---------------------------------- public class Bicycle { private int tire; private int front; private int rear; public Bicycle( int f,int r, int t ) { tire=t; front=f; rear=r; } public int getFront( ) { return front; } public int getRear( ) { return rear; } public double getRatio( ) { return (double)front/rear; } } ------------------------------------- import java.util.*; public class BicycleTest { public static void main( String[] args ) { int tire=26,front=30,rear=90; Scanner in=new Scanner (System.in); System.out.print("Enter front wheel teeth: "); front=in.nextInt(); System.out.print("Enter rear wheel teeth: "); rear=in.nextInt(); Bicycle bike=new Bicycle(front,rear,tire); System.out.printf("front teeth= %d rear teeth = %d gear ratio=%f ", bike.getFront(),bike.getRear( ),bike.getRatio()); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote