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 src/Lab003a.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 src/Lab003b.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 src/Lab003c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions src/LabThree.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import java.io.OutputStream;

public class LabThree {

public static void main(String[] args) {
int gallon = 1;
double liter = 3.78541;
int cup = 16;
double quart = 4.0;
double a,b, c;
a = 2.5;
b = 5.5;
c = 12.3;
float D = 22;
int E = 6/5;
System.out.printf("Half of b = "+b/2
);
System.out.println();
float G = 4/3f;
System.out.printf("value : %.4f\n" , G);
System.out.printf("Four thirds = %.3f\n" , 4.0 / 3.0);
System.out.printf("percent of days gone = %.4f" , 33.0 /366.0);
System.out.println();
System.out.printf( "I am ironman = %d", 666);
System.out.println();
System.out.printf("%d Cup = %f Quart\n", cup, quart);
System.out.printf("%d Gallon = %f Liter", gallon, liter );
System.out.println();
int J = 42;
System.out.printf("this will work = %d %f",E, G);



}
}

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) {
System.out.printf("What is the temperature in Celsius?\n");
Scanner scanner = new Scanner(System.in);
double celsius = scanner.nextDouble();
double fahrenheit = ((celsius * 9/5) + 32);
System.out.printf("%.1f degrees Celsius is equal to %.1f degrees Fahrenheit\n", celsius, fahrenheit);

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

public class Time {
public static void main(String[] args) {

System.out.printf("Enter the total time in seconds:\n");
Scanner scanner = new Scanner(System.in);
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", totalseconds, hours, minutes, seconds);
scanner.close();
}
}