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 error1.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 error2.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 error3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/Format.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
public class Format {

public static void main(String[] args) {

int Value = 24;
System.out.printf("%f", Value);

double doubleValue = 6.42;
System.out.printf("%d", doubleValue);

int Value1 = 42;
System.out.printf("%d %s", Value1);


}
}
16 changes: 16 additions & 0 deletions src/TempConvert.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import java.util.Scanner;

public class TempConvert {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.print("Enter a temperature in Celsius: ");
double celsius = scanner.nextDouble();

double fahrenheit = celsius * 9 / 5 + 32;
System.out.printf("%.1f C = %.1f F%n", celsius, fahrenheit);

scanner.close();

}
}
19 changes: 19 additions & 0 deletions src/TimeConvert.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import java.util.Scanner;

public class TimeConvert {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.print("Enter the total number of seconds: ");
int totalSeconds = scanner.nextInt();

int hours = totalSeconds / 3600;
int minutes = (totalSeconds % 3600) / 60;
int seconds = totalSeconds % 60;

System.out.printf("%d seconds = %d hours, %d minutes, and %d seconds%n", totalSeconds, hours, minutes, seconds);

scanner.close();
}
}