1.

Write a program that asks the user to enter the monthly costs for the following expenses incurred from operating his or her automobile: loan payment, insurance, gas, oil, tires, and maintenance. The program should then display the total monthly cost of these expenses, and the total annual cost of these expenses.

Answer»

import java.util.Scanner;public class user{public STATIC void main(STRING ARGS[]);{Scanner in = new Scanner(System.in);int l, i, g, o, t, m, sum, sum2;System.out.println("Input your monthly expence");l=in.nextInt();i=in.nextInt();g=in.nextInt();o=in.nextInt();t=in.nextInt();m=in.nextInt();sum=l+i+g+o+t+m;sum2=l+i+g+o+t+m*365;System.out.println("Here's your total monthly expence ="+sum);System.out.println("Here's your total YEARLY expence ="+sum2);}}



Discussion

No Comment Found