โปรแกรมแปลงเวลา จาวา

แนะนำ สอบถาม ภาษา C สำหรับผู้เริ่มต้น

Moderator:

User avatar
nokroo
Posts: 188
Joined: 01/01/1970 7:00 am
Location: วัดตะคร้ำเอน ต.ตะคร้ำเอน อ.ท่ามะกา จ.กาญจนบุรี

โปรแกรมแปลงเวลา จาวา

Postby nokroo » 05/10/2013 8:13 am

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package javaapplication2;

import static java.lang.System.exit;
import java.util.Scanner;

/**
*
* @author นกแสก
*/
public class JavaApplication2 {

public static void main(String[] arg){
float second;
float n;
float m;
float minute;
int choice;


Scanner sc = new Scanner(System.in);

System.out.println("\n");

System.out.println("\n\n***-------Conversion time-------***\n\n");

System.out.println("\n\nMain Menu\n\n");

System.out.println("\n\nPlease Select choice: \n1. Convert seconds to minutes.\n2. Convert minutes to seconds. \n3. Exit\n\n");

choice = sc.nextInt();



if(choice == 1){

Scanner sc1 = new Scanner(System.in);

System.out.print("Enter the number second : ");

n = sc.nextInt();

minute = n/60;

System.out.println("Convert second to minute = "+minute);

}

if(choice == 2){

Scanner sc1 = new Scanner(System.in);

System.out.print("Enter the number minute : ");

m = sc.nextInt();

second = m*60;

System.out.println("Convert minutes to seconds = "+second);

}

if(choice == 3){

System.out.println("\n\nExit\n\n");

exit(0);//To change body of generated methods, choose Tools | Templates.
}
}
}

Return to “Programming - C/C<sup>++</sup>& java”

Who is online

Users browsing this forum: No registered users and 1 guest