Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ To update this Project's SDK to use Java11 on your computer:
Occasionally, the LaunchCode team will make changes to this repository
that will affect your coursework. When you start your prep-work for each
lesson of the course, be sure to fetch to stay up to date with the
latest changes.
latest changes.

Group 3
14 changes: 14 additions & 0 deletions src/funWithQuizzes/CheckBox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package funWithQuizzes;

import java.util.ArrayList;

public class CheckBox extends Questions{

private ArrayList<String> choices = new ArrayList<>();


public CheckBox(String question, String correctAnswer,ArrayList<String> choices) {
super(question, correctAnswer);
this.choices = choices;
}
}
10 changes: 10 additions & 0 deletions src/funWithQuizzes/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package funWithQuizzes;

import java.util.Scanner;

public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in) ;
//CheckBox checkBoxQ1 =new CheckBox("")
}
}
13 changes: 13 additions & 0 deletions src/funWithQuizzes/MultipleChoice.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package funWithQuizzes;

import java.util.ArrayList;

public class MultipleChoice extends Questions{
private ArrayList<String> choices = new ArrayList<>();


public MultipleChoice(String question, String correctAnswer,ArrayList<String> choices) {
super(question, correctAnswer);
this.choices = choices;
}
}
28 changes: 28 additions & 0 deletions src/funWithQuizzes/Questions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package funWithQuizzes;

public class Questions {

private static Integer iD;
private Integer nextId = 1;
private String question;
private String correctAnswer;
private boolean isCorrect;

// public Question(String questions){
// this.questions = questions;
// }

// public Question(){
// this.iD = nextId;
// nextId++;
// }

public Questions(String question, String correctAnswer){
this.question = question;
this.correctAnswer = correctAnswer;
//this.isCorrect = isCorrect;
this.iD = nextId;
nextId++;
}

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

import java.util.ArrayList;

public class TrueFalse extends Questions {
private ArrayList<String> choices = new ArrayList<>();


public TrueFalse(String question, String correctAnswer,ArrayList<String> choices) {
super(question, correctAnswer);
this.choices = choices;
}
}
18 changes: 18 additions & 0 deletions src/org/launchcode/java/studios/areaofacircle/Area.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.launchcode.java.studios.areaofacircle;


import java.util.Scanner;

public class Area {
public static void main(String[] args) {
Scanner input;

input = new Scanner(System.in);

System.out.println("Enter a radius ");
Double radius = input.nextDouble();

System.out.println(Circle.getArea(radius));
}
}

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

public class Circle {
public static Double getArea (Double radius){
return 3.14 * radius * radius;
}
}
13 changes: 13 additions & 0 deletions src/restaurant/Menu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package restaurant;

import java.util.ArrayList;

public class Menu {

public static void main (String[] args){
ArrayList<String> restaurantMenu = new ArrayList<>();
System.out.println("Test");

}

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

public class MenuItem {

private double price;
private String description;
private String category;
private boolean isNew = true;


public MenuItem(double price, String description, String category) {
this.price = price;
this.description = description;
this.category = category;
this.isNew = true;
}


// getter for .price
public double getPrice() {
return this.price;
}

// getter for .description
public String getDescription() {
return description;
}

// getter for .category
public String getCategory() {
return category;
}

// getter for .isNew --> notice the syntax is a little different I didn't use getIsNew() -> just isNew() makes sense as it can only return either true or false
public boolean isNew() {
return isNew;
}

// setter for .price()
public void setPrice(double price) {
this.price = price;
}

// setter for .description
public void setDescription(String description) {
this.description = description;
}

// setter for isNew
public void setNew(boolean isNew) {
this.isNew = isNew;
}
}
35 changes: 35 additions & 0 deletions src/studio2/CountingCharacters.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package studio2;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Scanner;

public class CountingCharacters {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter a string of Characters : ");
String quote = input.nextLine().toLowerCase(Locale.ROOT);

input.close();

// String quote = "If the product of two terms is zero then common sense says at least one of the two terms has to be zero to start with." +
// " So if you move all the terms over to one side, you can put the quadratics into a form that can be factored allowing that side of the equation to equal zero." +
// " Once you’ve done that, it’s pretty straightforward from there. ";
char[] charactersInString = quote.toCharArray();
HashMap<Character, Integer> count = new HashMap<>();
for (char i : charactersInString) {

if (count.containsKey(i)) {
count.put(i, count.get(i) + 1);

} else {
count.put(i, 1);
}

}
for (Map.Entry entry : count.entrySet()) {
System.out.println(entry.getKey() + " : " + entry.getValue());
}
}
}
41 changes: 41 additions & 0 deletions src/studio3/CountingCharacters.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package studio3;


import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Scanner;

public class CountingCharacters {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);
System.out.println("Enter a string of characters: ");

String quote = input.nextLine().toLowerCase();
input.close();

// String quote = "If the product of two terms is zero then common sense says at least one of the two terms has to be zero to start with. " +
// "So if you move all the terms over to one side, you can put the quadratics into a form that can be factored allowing that side of the equation to equal zero." +
//" Once you’ve done that, it’s pretty straightforward from there.";

char [] charactersInString = quote.toCharArray();

HashMap <Character, Integer> count = new HashMap<>();

for(char i:charactersInString) {

if (count.containsKey(i)) {
count.put(i, count.get(i) + 1);
} else {
count.put(i, 1);
}
}
for (Map.Entry entry : count.entrySet()){
System.out.println(entry.getKey() + " " + entry.getValue());
}
// main(quote);
}

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

public abstract class BaseDisc {
private String name;
private double storageCapacity = 10.0;
private String content;
private String diskType;

public BaseDisc(String name, double storageCapacity, String content, String diskType) {
this.name = name;
this.storageCapacity = storageCapacity;
this.content = content;
this.diskType = diskType;
}

public String writeData(double dataEntered) {
storageCapacity -= dataEntered;
return "You've used " + dataEntered + " kB.";
}
public String readData() {
return "You have " + storageCapacity + " kB left on this disc.";
}

public String reportInfo() {
return "This disc is a " + diskType + " called " + name + " .";
}

public String getName() {
return name;
}

public double getStorageCapacity() {
return storageCapacity;
}

public String getContent() {
return content;
}

public String getDiskType() {
return diskType;
}

public void setName(String name) {
this.name = name;
}

public void setStorageCapacity(double storageCapacity) {
this.storageCapacity = storageCapacity;
}

public void setContent(String content) {
this.content = content;
}

public void setDiskType(String diskType) {
this.diskType = diskType;
}
}
22 changes: 22 additions & 0 deletions src/studio7/CD.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package studio7;

public class CD extends BaseDisc implements OpticalDisc {
public CD(String name, double storageCapacity, String content, String diskType) {
super(name, storageCapacity, content, diskType);
}
@Override
public String spinDisk() {
return "Disc is spinning!";
}

@Override
public String storeData() {
return "Data is stored";
}

// TODO: Implement your custom interface.

// TODO: Determine which fields, methods, and constructors can be extended from the base class and which ones
// need to be declared separately.

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

public class DVD extends BaseDisc implements OpticalDisc {
public DVD(String name, double storageCapacity, String content, String diskType) {
super(name, storageCapacity, content, diskType);
// TODO: Implement your custom interface.

// TODO: Determine which fields, methods, and constructors can be extended from the base class and which ones
// need to be declared separately.

}

@Override
public String spinDisk() {
return "Disc is spinning!";
}

@Override
public String storeData() {
return "Data is stored";
}
}
13 changes: 13 additions & 0 deletions src/studio7/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package studio7;

public class Main {

public static void main (String[] args){

// TODO: Declare and initialize a CD and a DVD object.
DVD Titanic = new DVD("Titanic", 1000000000, "Movie", "DVD");
// TODO: Call each CD and DVD method to verify that they work as expected.
System.out.println(Titanic.spinDisk());
System.out.println(Titanic.readData());
}
}
7 changes: 7 additions & 0 deletions src/studio7/OpticalDisc.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package studio7;

public interface OpticalDisc {
String spinDisk();
String storeData();
}