mercredi 25 octobre 2017

How can I add loops?

import java.util.Scanner;

public class ProjectCell {

public static void main(String[] args) {
    Scanner Input = new Scanner(System.in);
    System.out.println("Welcome to ProjectCell");
    System.out.println("    ");

        int a = 1;
        int b = 2;

        System.out.println("Main Menu");
        System.out.println("If you want to questionize your remaining balance, please click 1");
        System.out.println("If you want to get information about remaining usage, please click 2");

        int answer = Input.nextInt();

        int i = (int) (Math.random()*100);

        if (answer == 1 ) {

         System.out.println("Your remaining balance is " +  i  +  " TL"); }


        else
        {
        int k = (int) (Math.random()*1000);
        int l = (int) (Math.random()*1000);
        int m = (int) (Math.random()*1000);
        int o = (int) (Math.random()*1000);

        if (answer == 2) 

            System.out.println("Your remaining minutes is " + k + " DK ");
            System.out.println("Your remaining SMS is " + l);
            System.out.println("Your remaining MMS is " + m);
            System.out.println("Your remaining Internet is " + o + " MB "); 
        }
   }

}

How can ı add loops or how can ı use loops in this program? I know loops but ı need an ıdea.

Aucun commentaire:

Enregistrer un commentaire