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>
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,5 @@ Follow these steps for submission:
3. Push it to your Remote/origin branch (i.e., GitHub: Feature01 -> origin/Feature01).
4. Issue a Pull request to my instructor repo.
5. **Make sure to COPY the Pull request URL and submit it for the lab/assignment in Canvas.**


Binary file added src/Assignment failure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions src/TemperatureConvert.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import java.util.Scanner;
public class TemperatureConvert {

public static void main(String[] args) {
double F;
double C;
Scanner in = new Scanner(System.in);
System.out.print("Input temperature in Celsius: ");
C = in.nextDouble();
System.out.println("Your input " + C + "C");
F = (C * 9 / 5) + 32;
System.out.println(C + "C" + " = " + F + "F");
System.out.println(F + "F" + " = " + C + "C");
in.close();

/* Just for my own practice, I'm putting the code down in reverse.
double F;
double C;
Scanner in = new Scanner(System.in);
System.out.print("Input temperature in Fahrenheit: ");
F = in.nextDouble();
System.out.println("You input " + F + "F");
C = (F - 32) * 5/9;
System.out.println(C + "C" + " = " + F + "F");
System.out.println(F + "F" + " = " + C + "C");
in.close();
*/

}
}

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

public class TimeConverter {
public static void main(String[] args) {
int hour, minute, second, seconds;
final int minPerHr = 60 * 60; // 3600
Scanner in = new Scanner(System.in);
System.out.print("Input number of seconds: ");
seconds = in.nextInt();
second = seconds % 60 % 60;
minute = (seconds % minPerHr) / 60;
hour = seconds / 60 / 60;
System.out.print(hour + " hours ");
System.out.print(minute + " minutes ");
System.out.println(second + " seconds.");
System.out.printf("%d seconds = %d hours, %d minutes, and %d seconds.", seconds, hour, minute, second);
in.close();
}
}