Write a program that calculates the annual cost of running an appliance. The program will ask the user for the cost per kilowatt-hour and the number of kilowatt-hours the appliance uses in a year:
Enter cost per kilowatt-hour in cents: 8.42
Enter kilowatt-hours used per year : 653
Annual cost: 54.9826
1
Expert's answer
2014-08-13T09:16:32-0400
import java.util.Scanner; public class Main { public static void main(String[] args) { double cost = 0; double used = 0; Scanner inpScan = new Scanner(System.in);
System.out.print("Enter cost per kilowatt-hour in cents: "); cost = Double.parseDouble(inpScan.nextLine());
System.out.print("Enter kilowatt-hours used per year: "); used = Double.parseDouble(inpScan.nextLine());
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment