Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Java-Lab-003.iml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Binary file added error01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added error02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added error03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/TempConvert.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import java.util.Scanner;
public class TempConvert {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter a temperature in Celsius: ");
double C,F;
C=in.nextDouble();
System.out.println("Enter a temperature in Celsius: " +C);
F= C*(9.0/5.0)+32;
System.out.printf("%.1f C = %.1f F", C, F);
}
}
17 changes: 17 additions & 0 deletions src/Time.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import java.util.Scanner;
public class Time {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter a total number of seconds ");
final int SECONDS_PER_MINUTE=60;
final int MINUTES_PER_HOUR=60;
int totalSeconds, secondsE,hours, minutes, seconds;
totalSeconds=in.nextInt();
System.out.println("Enter a total amount of seconds: " + totalSeconds);
secondsE=totalSeconds%(MINUTES_PER_HOUR*SECONDS_PER_MINUTE);
hours= totalSeconds/(MINUTES_PER_HOUR*SECONDS_PER_MINUTE);
minutes=secondsE/SECONDS_PER_MINUTE;
seconds=totalSeconds-(hours*SECONDS_PER_MINUTE*MINUTES_PER_HOUR)-(minutes*SECONDS_PER_MINUTE);
System.out.printf("%d seconds = %d hours %d minutes %d seconds", totalSeconds, hours, minutes,seconds );
}
}