Question

A jiffy

3.13 LAB: A jiffy

A “jiffy” is the scientific name for 1/100th of a second. Given an input number of seconds, output the number of "jiffies."

Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
System.out.printf("%.2f", yourValue);

Ex: If the input is:

15

the output is:

1500.00

Your program must define and call a method:
public static double secondsToJiffies(double userSeconds)


1 0
Add a comment Improve this question Transcribed image text
✔ Recommended Answer
Answer #1
import java.util.Scanner;

public class LabProgram {
   
   public static double secondsToJiffies(double userSeconds) {
      
      double jiffy;
      
      jiffy = userSeconds * 100;
      
      return jiffy;
      
   }
   
   public static void main(String[] args) {
      
      Scanner scnr = new Scanner(System.in);
      double inputNum;
      double jiffy;
      
      inputNum = scnr.nextDouble();
      
      jiffy = secondsToJiffies(inputNum);
      
      System.out.printf("%.2f", jiffy);
      
   }
   
}


Add a comment
Know the answer?
Add Answer to:
A jiffy
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Driving cost - methods

    3.14 LAB: Driving cost - methodsWrite a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type double. If the method is called with 50 20.0 3.1599, the method returns 7.89975.Define that method in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both doubles). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your drivingCost() method three times.Output each...

  • Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallo

    6.26 LAB: Driving cost - methodsWrite a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type double. If the method is called with 50 20.0 3.1599, the method returns 7.89975.Define that method in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both doubles). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your drivingCost() method three times.Output...

  • NEED CODE IN CORAL A "jiffy" is the scientific name for 1/100th of a second. Given...

    NEED CODE IN CORAL A "jiffy" is the scientific name for 1/100th of a second. Given an input number of seconds, output the number of "jiffies." Ex: If the input is 15, the output is: 1500 Your program should define and call a function: Function SecondsToJiffies(float userSeconds) returns float userJiffies

  • Java 6.16 LAB: Adjust list by normalizing

    When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustment can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by dividing all values by the largest value. The input begins with an integer indicating the number of floating-point values that follow. Assume that the list will always contain fewer than 20 floating-point values. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("%.2f", yourValue); Ex: If the input is: 5 30.0 50.0 10.0 100.0 65.0 the output is: 0.30 0.50 0.10 1.00 0.65  The 5 indicates that there are five floating-point values in the list, namely 30.0, 50.0, 10.0, 100.0, and 65.0. 100.0 is the largest value in the list, so each value is divided by 100.0. For coding simplicity, follow every output value by a space, including the last one. import java.util.Scanner;  public class LabProgram {    public static void main(String[] args) {       /* Type your code here. */    } }

  • Write a function DrivingCost with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon

    Write a function DrivingCost with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type double. If the function is called with 5020.03 .1599, the function returns 7.89975 .Define that function in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both doubles). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your DrivingCost function three times.Output each floating-point value with two...

  • (C++) One lap around a standard high-school running track is exactly 0.25 miles

    17.1 LAB: Niles to track laps  (C++)One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input, and outputs the number of laps.Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout << fixed << setprecision(2); once before all other cout statements.Ex. If the input is:1.5the output is:6.00Ex: If the input is:2.2the output is:8.80Your program must define and call a function: double...

  • 6.13 LAB: Step counter. Section 6.3. A pedometer treats walking 2,000 steps as walking 1 mile....

    6.13 LAB: Step counter. Section 6.3. A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output is the miles walked. Your program must define and call the following function. The function should return the amount of miles walked (that is: user_steps / 2000). def steps_to_miles(user_steps) Ex: If the input is: 5345 the output is: 2.67 Output each floating-point value with two digits after the decimal point, which...

  • (JAVA) One lap around a standard high-school running track is exactly 0.25 miles

    (JAVA) 7.12 LAB: Miles to track lapsOne lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input, and outputs the number of laps.Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.print f("%.2 f", yourValue);Ex: if the input is.1.5the output is:6.00Ex: if the input is:2.2the output is:8.80

  • A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is...

    A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output is the miles walked. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f}'.format(your_value)) Ex: If the input is: 5345 the output is: 2.67 Your program must define and call the following function. The function should return the amount of miles walked. def steps_to_miles(user_steps) answer must be in Phython...

  • Musical note frequencies

    3.11 LAB: Musical note frequenciesOn a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 * rn, where n is the distance (number of keys) from that key, and r is 2(1/12). Given an initial key frequency, output that frequency and the next 4 higher key frequencies.Output each floating-point value with two digits after the decimal point, which can be achieved as follows:System.out.printf("%.2f", yourValue);Ex: If the input is:440.0(which is the A...

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