Skip to content

Commit 6bce757

Browse files
author
Tâm Lê
committed
complete lab06_01
1 parent 711a507 commit 6bce757

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/lab_06/Lab_06_01.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package lab_06;
2+
/*
3+
Requirement:
4+
Given input string: "2hrs and 5 minutes"
5+
Please calculate how many minutes in total
6+
*/
7+
public class Lab_06_01 {
8+
public static void main(String[] args) {
9+
String myInputTime = new String("2 hours and 5 mintues");
10+
char hourvalue = myInputTime.charAt(0);
11+
char mintuesvalue = myInputTime.charAt(12);
12+
int myHour = Integer.parseInt(String.valueOf(hourvalue));
13+
int myMintues = Integer.parseInt(String.valueOf(mintuesvalue));
14+
int mintuesCovert = (myHour * 60);
15+
System.out.println("Totlal mintues is " + (mintuesCovert + myMintues));
16+
}
17+
}

0 commit comments

Comments
 (0)