Skip to content
Open

main #28

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
12 changes: 12 additions & 0 deletions src/exercises/Joseph.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package exercises;

import java.util.Scanner;
public class Joseph {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Hello, what is your name:");
String name = input.nextLine();
System.out.println("Hello " + name);

}
}
18 changes: 18 additions & 0 deletions src/exercises/miles.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package exercises;

import java.util.Scanner;
public class miles {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("How many miles have you driven?");
Double numMiles = input.nextDouble();

System.out.println("How much gas did you use? In gallons.");
Double numGallons = input.nextDouble();

Double mpg = numMiles / numGallons;
System.out.println("You are running on " + mpg + " mpg.");


}
}
23 changes: 23 additions & 0 deletions src/exercises/rectangle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package exercises;

import java.util.Scanner;
public class rectangle {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

double length;
double width;
double area;

System.out.println("Enter the length of a rectangle: ");
length = input.nextDouble();

System.out.println("Enter the width of a rectangle: ");
width = input.nextDouble();


area = (length/width);
System.out.println("The area of your rectangle is: " + area + "°A");

}
}
15 changes: 15 additions & 0 deletions src/exercises/strings.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package exercises;

import java.util.Scanner;
public class strings {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String str = "Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, 'and what is the use of a book,' thought Alice 'without pictures or conversation?'";

Integer index = firstSentence.indexOf(searchTerm);
Integer length = searchTerm.length();
System.out.println("Your search term first appears at index " + index + ". Your term is " + length + " characters long.");
String modifiedSentence = firstSentence.replace(searchTerm, "");
System.out.println(modifiedSentence);
}
}
2 changes: 1 addition & 1 deletion src/org/launchcode/java/demos/Hello.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
*/
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, World");
System.out.println("Hello, Joseph");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class HelloMethods {

public static void main(String[] args) {
String message = Message.getMessage("fr");
String message = Message.getMessage("en");
System.out.println(message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ public class TempConverter {
public static void main(String[] args) {
double fahrenheit;
double celsius;
Scanner input;

input = new Scanner(System.in);
Scanner input = new Scanner(System.in);
System.out.println("Enter the temperature in Fahrenheit: ");
fahrenheit = input.nextDouble();
input.close();
Expand Down
11 changes: 11 additions & 0 deletions src/org/launchcode/java/studios/areaofacircle/Area.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.launchcode.java.studios.areaofacircle;

import org.launchcode.java.demos.lsn1datatypes.Message;

import java.util.Scanner;
public class Area {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

}
}
9 changes: 9 additions & 0 deletions src/org/launchcode/java/studios/areaofacircle/Circle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.launchcode.java.studios.areaofacircle;

public class Circle {
public static Double getArea(Double radius) {
return 3.14 * radius * radius;

}
}