diff --git a/README.md b/README.md index 12557a8a6..032ccf05e 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +latest changes. + +Group 3 \ No newline at end of file diff --git a/src/funWithQuizzes/CheckBox.java b/src/funWithQuizzes/CheckBox.java new file mode 100644 index 000000000..8913263d0 --- /dev/null +++ b/src/funWithQuizzes/CheckBox.java @@ -0,0 +1,14 @@ +package funWithQuizzes; + +import java.util.ArrayList; + +public class CheckBox extends Questions{ + + private ArrayList choices = new ArrayList<>(); + + + public CheckBox(String question, String correctAnswer,ArrayList choices) { + super(question, correctAnswer); + this.choices = choices; + } +} diff --git a/src/funWithQuizzes/Main.java b/src/funWithQuizzes/Main.java new file mode 100644 index 000000000..91457c41f --- /dev/null +++ b/src/funWithQuizzes/Main.java @@ -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("") + } +} diff --git a/src/funWithQuizzes/MultipleChoice.java b/src/funWithQuizzes/MultipleChoice.java new file mode 100644 index 000000000..b4ed18b23 --- /dev/null +++ b/src/funWithQuizzes/MultipleChoice.java @@ -0,0 +1,13 @@ +package funWithQuizzes; + +import java.util.ArrayList; + +public class MultipleChoice extends Questions{ + private ArrayList choices = new ArrayList<>(); + + + public MultipleChoice(String question, String correctAnswer,ArrayList choices) { + super(question, correctAnswer); + this.choices = choices; + } +} diff --git a/src/funWithQuizzes/Questions.java b/src/funWithQuizzes/Questions.java new file mode 100644 index 000000000..063ea72bd --- /dev/null +++ b/src/funWithQuizzes/Questions.java @@ -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++; + } + +} diff --git a/src/funWithQuizzes/TrueFalse.java b/src/funWithQuizzes/TrueFalse.java new file mode 100644 index 000000000..688c794e8 --- /dev/null +++ b/src/funWithQuizzes/TrueFalse.java @@ -0,0 +1,13 @@ +package funWithQuizzes; + +import java.util.ArrayList; + +public class TrueFalse extends Questions { + private ArrayList choices = new ArrayList<>(); + + + public TrueFalse(String question, String correctAnswer,ArrayList choices) { + super(question, correctAnswer); + this.choices = choices; + } +} diff --git a/src/org/launchcode/java/studios/areaofacircle/Area.java b/src/org/launchcode/java/studios/areaofacircle/Area.java new file mode 100644 index 000000000..3e3556b2f --- /dev/null +++ b/src/org/launchcode/java/studios/areaofacircle/Area.java @@ -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)); + } +} + diff --git a/src/org/launchcode/java/studios/areaofacircle/Circle.java b/src/org/launchcode/java/studios/areaofacircle/Circle.java new file mode 100644 index 000000000..850381634 --- /dev/null +++ b/src/org/launchcode/java/studios/areaofacircle/Circle.java @@ -0,0 +1,7 @@ +package org.launchcode.java.studios.areaofacircle; + +public class Circle { + public static Double getArea (Double radius){ + return 3.14 * radius * radius; + } +} diff --git a/src/restaurant/Menu.java b/src/restaurant/Menu.java new file mode 100644 index 000000000..780c83bc3 --- /dev/null +++ b/src/restaurant/Menu.java @@ -0,0 +1,13 @@ +package restaurant; + +import java.util.ArrayList; + +public class Menu { + + public static void main (String[] args){ + ArrayList restaurantMenu = new ArrayList<>(); + System.out.println("Test"); + + } + +} diff --git a/src/restaurant/MenuItem.java b/src/restaurant/MenuItem.java new file mode 100644 index 000000000..8b746760b --- /dev/null +++ b/src/restaurant/MenuItem.java @@ -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; + } +} diff --git a/src/studio2/CountingCharacters.java b/src/studio2/CountingCharacters.java new file mode 100644 index 000000000..667523f03 --- /dev/null +++ b/src/studio2/CountingCharacters.java @@ -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 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()); + } + } +} diff --git a/src/studio3/CountingCharacters.java b/src/studio3/CountingCharacters.java new file mode 100644 index 000000000..9b2bb4360 --- /dev/null +++ b/src/studio3/CountingCharacters.java @@ -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 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); + } + +} diff --git a/src/studio7/BaseDisc.java b/src/studio7/BaseDisc.java new file mode 100644 index 000000000..995beb918 --- /dev/null +++ b/src/studio7/BaseDisc.java @@ -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; + } +} diff --git a/src/studio7/CD.java b/src/studio7/CD.java new file mode 100644 index 000000000..0bf42fe25 --- /dev/null +++ b/src/studio7/CD.java @@ -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. + +} diff --git a/src/studio7/DVD.java b/src/studio7/DVD.java new file mode 100644 index 000000000..d057f4f74 --- /dev/null +++ b/src/studio7/DVD.java @@ -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"; + } +} diff --git a/src/studio7/Main.java b/src/studio7/Main.java new file mode 100644 index 000000000..8af5c1e1c --- /dev/null +++ b/src/studio7/Main.java @@ -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()); + } +} diff --git a/src/studio7/OpticalDisc.java b/src/studio7/OpticalDisc.java new file mode 100644 index 000000000..ac65200a1 --- /dev/null +++ b/src/studio7/OpticalDisc.java @@ -0,0 +1,7 @@ +package studio7; + +public interface OpticalDisc { + String spinDisk(); + String storeData(); +} +