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 error01_fixed.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 error02_fixed.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.
14 changes: 14 additions & 0 deletions src/PartOne.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
public class PartOne {

public static void main(String[] args) {

int apples = 55;
double seeds = 128.5;

System.out.printf("\nThe Farmer was selling a total of %d apples.\n" +
"And each apple contains about %.2f seeds\n", apples, seeds);



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

public class TempConvert {

public static void main(String[] args) {

int celsius;

Scanner wthr = new Scanner(System.in);

System.out.println("What is the weather in Nezahualcóyotl, Mexico right now?");
celsius = wthr.nextInt();

double fahrenheit = celsius * 9/5 + 32;
// I put "9/5" in parentheses and that completely changed the answer.
System.out.printf("In Fahrenheit that's: %.1f\n", fahrenheit);
System.out.printf("\n%d C = %.1f F\n", celsius, fahrenheit);

}

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

public class TimeConvert {

public static void main(String[] args) {

int seconds;
final int SECONDS_PER_MINUTE = 60;
final int SECONDS_PER_HOUR = 3600;

Scanner time = new Scanner(System.in);

System.out.println("Enter a number of seconds: ");
seconds = time.nextInt();

int hours = seconds / SECONDS_PER_HOUR;
int minutes = seconds / SECONDS_PER_MINUTE % SECONDS_PER_MINUTE;
int secondsRemaining = seconds % SECONDS_PER_MINUTE;

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



}
}