-4

I want to write a code that counts minutes in last three days. Let's say user makes an input every new day. He can see the sum of minutes for the last three days.

I need to replace variables values whenever the new input is issued. So when the first input is created it goes to variable c. When the new input is created its value goes to variable c, the value of former variable c goes to b. When the next input is created the new value goes to c, the former c goes to b and the former b goes to a and so on

import java.util.Scanner;

public class NewClass2{
    public static void main (String[] args){

        double a=0, b=0, c=0;

        Scanner input = new Scanner (System.in);
        System.out.print("Input some minutes: ");
        c = input.nextDouble();

        //b=c, a=b;
Sampson Crowley
  • 1,244
  • 1
  • 9
  • 22
uberfella
  • 1
  • 1

1 Answers1

0

Easiest solution

 import java.util.Scanner;

 public class NewClass2{
     public static void main (String[] args){

        double a=0, b=0, c=0;

        Scanner input = new Scanner (System.in);
        System.out.print("Input some minutes: ");
        a=b;
        b=c;
        c = input.nextDouble();


      }
darkhouse
  • 205
  • 5
  • 15