Can u help me meet my requirements? link to instruction and example outputs. https://s3.amazonaws.com/csrepository/java2021/15/Act/activity.html?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJHBTV2SX4FXCL2GQ%2F20220116%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220116T040804Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=cd1378f52f56517e18a55f091cad5ae328e9b60e59f143646ecf5ed027abd868 Their are 5
Question:
Can u help me meet my requirements?
link to instruction and example outputs.
https://s3.amazonaws.com/csrepository/java2021/15/Act/activity.html?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJHBTV2SX4FXCL2GQ%2F20220116%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220116T040804Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=cd1378f52f56517e18a55f091cad5ae328e9b60e59f143646ecf5ed027abd868
Their are 5 sets of codes. RaceTrack.java, IRacer.java, Dragster.java, cheetah.java, and UFO.java
I don't have the codes for the last 3 javas.
CODE:
import java.util.*;
public class RaceTrack { public static void main(String[] args) { // set up user input Scanner input = new Scanner(System.in); System.out.print("Enter the name and Nitrous Oxide level (0-100) for the Dragster: "); String dragsterName = input.next(); int nitrousOxide = input.nextInt(); System.out.print("Enter the name and hunger level (1-10) for the Cheetah: "); String cheetahName = input.next(); int hungry = input.nextInt(); System.out.print("Enter the name and antimatter use (true/false) for the UFO: "); String ufoName = input.next(); boolean antimatter = input.nextBoolean();
// create IRacers IRacer r1 = new Dragster(dragsterName, nitrousOxide); IRacer r2 = new Cheetah(cheetahName, hungry); IRacer r3 = new UFO(ufoName, antimatter);
double time1 = r1.race(100); double time2 = r2.race(100); double time3 = r3.race(100);
System.out.println(); // blank line printResults(r1,time1); printResults(r2,time2); printResults(r3,time3);
input.close(); // close out user input } private static void printResults(IRacer racer, double time) { System.out.println(racer.getName() + " finished in " + time + " seconds"); } }
CODE:
public interface IRacer { // the race() method will return the time it takes to cover the specified distance public double race(int meters); // the getName() method will return a descriptive name for the racer public String getName(); }