Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package les;
- import java.util.Scanner;
- public class TotalSale
- {
- //input daily sales, then adds
- public static void main(String[] args)
- {
- Scanner k = new Scanner(System.in);
- int days;
- double dailys, totals = 0;
- System.out.print("how many days do yo u have sales figures:");
- days = k.nextInt();
- //"it = 1" is initialization expression,
- //it == days is test expression
- // it++ is update expression
- for (int it = 1; it <= days; it++ )
- {k.nextLine();
- System.out.print("enter sales for day "+it+" : ");
- dailys = k.nextInt();
- totals += dailys;
- }
- System.out.printf("%.2f", totals);
- k.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement