Repository where I will be uploading my submissions for exercise solutions from the "Java Programming I" course from the University of Helsinki.
The exercise solutions were submitted using the TMC (test my code) plugin from the Univerity of Helsinki using IntelliJ Idea, the submissions stored here are for keepsake, personal achievement and public access to my course completion.
The exercise submissions are placed in a folder based on the part of the course they were from.
For example, the exercise solution submissions for part 1 will be in the "Part1ExerciseSubmissions" folder, below will be the parts of the courses with their exercises and solution submissions all in order.
Details about the readings, quizzes and other components of the course will be in the wiki.
public class Sandbox {
public static void main(String[] args) {
// Write your program here
}
}
The purpose of this program was to simply submit something through the TMC (Test My Code) plugin from the University of Helsinki, to get familiarized with it.
Nothing. Simply a submission exercise.
public class AdaLovelace {
public static void main(String[] args) {
// Write your program here
System.out.println("Ada Lovelace");
}
}
Simple console based output.
public class OnceUponATime {
public static void main(String[] args) {
// Write your program here
System.out.println("Once upon a time");
System.out.println("there was ");
System.out.println("a program");
}
}
Printing more than one line.
public class Dinosaur {
public static void main(String[] args) {
// Write your program here
System.out.println("Once upon a time");
System.out.println("there was");
System.out.println("a dinosaur");
}
}
Using the 'sout' command to quickly write printing lines.
import java.util.Scanner;
public class Message {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Write a message:");
String message = scanner.nextLine();
System.out.println(message);
}
}
Getting a string from the user.
public class HiAdaLovelace {
public static void main(String[] args) {
String name = "Ada Lovelace!";
System.out.println("Hi " + name);
}
}
Using strings with a text output.
import java.util.Scanner;
public class MessageThreeTimes {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Write a message:");
String message = scanner.nextLine();
System.out.println(message);
System.out.println(message);
System.out.println(message);
}
}
Printing a user inputed string three times in a row.
import java.util.Scanner;
public class Greeting {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("What's your name?");
String message = scanner.nextLine();
System.out.println("Hi " + message);
}
}
Greeting a user after they input their name using strings.
import java.util.Scanner;
public class Conversation {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Greetings! How are you doing?");
String doing = scanner.nextLine();
System.out.println("Oh, how interesting. Tell me more!");
String more = scanner.nextLine();
System.out.println("Thanks for sharing!");
}
}
Using user string inputs to form a little conversation.
import java.util.Scanner;
public class Story {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("I will tell you a story, but I need some information first.");
System.out.println("What is the main character called?");
String name = scanner.nextLine();
System.out.println("What is their job?");
String job = scanner.nextLine();
System.out.println("Here is the story:");
System.out.println("Once upon a time there was " + name + ", who was " + job + ".");
System.out.println("On the way to work, " + name + " reflected on life.");
System.out.println("Perhaps " + name + " will not be " + job + " forever.");
}
}
Forming complicated text based on user input.