Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature commandos 1-8 #2

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
29a5d72
Maven added, David Student class and Darwin Course class
Darwin231 Feb 24, 2024
94505a4
Teacher commit
XaviSB Feb 24, 2024
c83641b
Maven set
Darwin231 Feb 24, 2024
3bde6f2
Merge remote-tracking branch 'origin/main'
Darwin231 Feb 24, 2024
22900ca
Maven set
Darwin231 Feb 24, 2024
a0d3cb2
Teacher class added to Course.java
Darwin231 Feb 24, 2024
308ebaf
Teacher commit 2
XaviSB Feb 24, 2024
ed8dc6d
fix teacher class
XaviSB Feb 24, 2024
c72603d
Merge pull request #1 from Darwin231/feature_teacher_application
XaviSB Feb 24, 2024
da605c9
Commands class created
jtiradohernandez Feb 24, 2024
0ca2b3d
Merge pull request #3 from jtiradohernandez/CommandBase
jtiradohernandez Feb 24, 2024
2bbf919
save commit after merge to this branch
XaviSB Feb 24, 2024
4f88d19
minor changes student
celularfreak Feb 24, 2024
f04c24f
Change from arrays to maps in Command class
jtiradohernandez Feb 24, 2024
4939741
Merge pull request #4 from Darwin231/CommandSelector
jtiradohernandez Feb 24, 2024
e8d3d2e
Merge branch 'main' into feature_application
XaviSB Feb 24, 2024
3a00d3d
save commit after merge to this branch
XaviSB Feb 24, 2024
5943c24
save commit after merge to this branch
XaviSB Feb 24, 2024
2aed7e0
save commit after merge to this branch
XaviSB Feb 24, 2024
0629425
commands 3-9
celularfreak Feb 24, 2024
81cd2cf
Merge pull request #5 from Darwin231/feature-commands-3-8
celularfreak Feb 24, 2024
2aef33a
command corrected
celularfreak Feb 24, 2024
552969b
minor change in Student
celularfreak Feb 24, 2024
ca462ad
save commit after merge to this branch
XaviSB Feb 24, 2024
b6a2ecd
Merge branch 'main' into feature_application
XaviSB Feb 24, 2024
1284ade
save commit after merge to this branch
XaviSB Feb 24, 2024
19a0483
Merge pull request #6 from Darwin231/feature_application
XaviSB Feb 24, 2024
c4e6ef2
Create enroll and assign classes
Darwin231 Feb 26, 2024
33e7134
commands 3 to 8 advance
Darwin231 Feb 29, 2024
9bd1eed
setMoneyEarned changed
Darwin231 Feb 29, 2024
ad4b7ed
Merge branch 'main' into feature-commandos-1-2
Darwin231 Feb 29, 2024
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: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Default ignored files
/shelf/
/.idea/workspace.xml

3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/homework-java-ironschool.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>groupId</groupId>
<artifactId>homework-java-ironschool</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
81 changes: 81 additions & 0 deletions src/main/java/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;

public class Application {

public static void main(String[] args) {

createSchoolName();
teacherDetails();
}

private static final Scanner scanner = new Scanner(System.in);

private static void createSchoolName() {
System.out.println("Welcome to the School Application");
System.out.println("Please enter the name of the school:");

String schoolName = scanner.nextLine();
System.out.println("Your school is: " + schoolName);

}

private static int number(SchoolComponents classToCount) {
int number;

do {
System.out.println(String.format("How many %s are there in the school: ", classToCount));
while (!scanner.hasNextInt()) {
System.out.println(String.format("Please enter a valid number for the %s ", classToCount));
scanner.next();
}
number = scanner.nextInt();

if (number <= 0) {
System.err.println(String.format("The number of %s can't be 0 or negative", classToCount));
} else if (number == 1) {
System.out.println(String.format("In your school there is only " + number + " %s", classToCount));
} else {
System.out.println(String.format("In your school there are " + number + " %s", classToCount));
}

} while (number <= 0);

return number;

}

private static Map<String,Teacher> teacherDetails() {
Map<String,Teacher> teachersMap = new HashMap<>();
int number = number(SchoolComponents.TEACHERS);
scanner.nextLine();
for (int i = 0; i < number; i++) {
System.out.println("Enter details for Teacher " + (i + 1) + ":");

System.out.println("Name: ");
String name = scanner.nextLine();

System.out.println("Salary: ");
double salary = Double.parseDouble(scanner.nextLine());

Teacher teacher = new Teacher(name, salary);
teachersMap.put(teacher.getTeacherId(), teacher);
}

/*for (Map.Entry<String, Teacher> entry : teachersMap.entrySet()) {
System.out.println("Teacher ID: " + entry.getKey() + ", Name: " + entry.getValue().getName() + ", Salary: " + entry.getValue().getSalary());
}*/

return teachersMap;

}



}




Loading