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.

Binary file added Error001.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 Error002.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 Error003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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>
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ For each of the issues above, screenshot and add the error images to this repo n
Your answers to this exercise should be added using Markdown into the project's `README.md` file so that they get committed with the project's code..

---
### **The errors I received are as follows:**
**Error #1:**
![Error001](Error001.png)

**Error #2:**
![Error002](Error002.png)

**Error #3:**
![Error003](Error003.png)
---
## Part 2: Celsius to Fahrenheit Converter

**Objective:**
Expand Down
17 changes: 17 additions & 0 deletions src/TempConvert.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import java.util.Scanner;

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

//Prompt user for number in Celsius and store value
System.out.print("Enter a number in Celsius: ");
numberInCelcius = in.nextDouble();

//Convert number to Fahrenheit and print result
numberInFahrenheit = numberInCelcius * 9/5 + 32;
System.out.printf("%.1f C = %.1f F", numberInCelcius, numberInFahrenheit);
}
}
21 changes: 21 additions & 0 deletions src/TimeConverter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import java.util.Scanner;

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

//Prompt user for input
System.out.print("Enter a total number of seconds: ");

//Read an integer from keyboard
int totalSeconds = in.nextInt();

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

//Display output of calculations
System.out.printf("%d seconds = %d hours, %d minutes, and %d seconds\n", totalSeconds, hours, minutes, seconds);
}
}