changed the file structure
This commit is contained in:
parent
cd81159162
commit
b1c3582880
391 changed files with 675 additions and 0 deletions
7
Code/Steiner/starSigns/.vscode/settings.json
vendored
Normal file
7
Code/Steiner/starSigns/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"java.project.sourcePaths": ["src"],
|
||||
"java.project.outputPath": "bin",
|
||||
"java.project.referencedLibraries": [
|
||||
"lib/**/*.jar"
|
||||
]
|
||||
}
|
18
Code/Steiner/starSigns/README.md
Normal file
18
Code/Steiner/starSigns/README.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
## Getting Started
|
||||
|
||||
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
|
||||
|
||||
## Folder Structure
|
||||
|
||||
The workspace contains two folders by default, where:
|
||||
|
||||
- `src`: the folder to maintain sources
|
||||
- `lib`: the folder to maintain dependencies
|
||||
|
||||
Meanwhile, the compiled output files will be generated in the `bin` folder by default.
|
||||
|
||||
> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
|
||||
|
||||
## Dependency Management
|
||||
|
||||
The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
|
BIN
Code/Steiner/starSigns/bin/App.class
Normal file
BIN
Code/Steiner/starSigns/bin/App.class
Normal file
Binary file not shown.
138
Code/Steiner/starSigns/src/App.java
Normal file
138
Code/Steiner/starSigns/src/App.java
Normal file
|
@ -0,0 +1,138 @@
|
|||
import java.util.Scanner;
|
||||
|
||||
public class App {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
while (true) {
|
||||
// user Input birthday
|
||||
int birthMonth = userInput("Your month");
|
||||
int birthDay = userInput("Your Birthday");
|
||||
// Is the date real + String
|
||||
boolean validateDate = validateDate(birthDay, birthMonth);
|
||||
if (validateDate) {
|
||||
getStarSign(birthMonth, birthDay);
|
||||
int userInput = userInput("Do you want to continue? 1 yes, 2 no");
|
||||
if (userInput == 2) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
System.out.println("Invalid date please enter another one");
|
||||
System.out.println("******************************");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int userInput(String myText) {
|
||||
Scanner scan = new Scanner(System.in);
|
||||
System.out.println(myText);
|
||||
return scan.nextInt();
|
||||
}
|
||||
|
||||
public static void getStarSign(int month, int day) {
|
||||
String starSign;
|
||||
switch (month) {
|
||||
case 1:
|
||||
if (day <= 20) {
|
||||
starSign = "Capricorn";
|
||||
} else {
|
||||
starSign = "Aquarius";
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (day <= 19) {
|
||||
starSign = "Aquarius";
|
||||
} else {
|
||||
starSign = "Pisces";
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (day <= 20) {
|
||||
starSign = "Pisces";
|
||||
} else {
|
||||
starSign = "Aries";
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (day <= 20) {
|
||||
starSign = "Aries";
|
||||
} else {
|
||||
starSign = "Taurus";
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (day <= 21) {
|
||||
starSign = "Taurus";
|
||||
} else {
|
||||
starSign = "Gemini";
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (day <= 21) {
|
||||
starSign = "Gemini";
|
||||
} else {
|
||||
starSign = "Cancer";
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (day <= 22) {
|
||||
starSign = "Cancer";
|
||||
} else {
|
||||
starSign = "Leo";
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
if (day <= 23) {
|
||||
starSign = "Leo";
|
||||
} else {
|
||||
starSign = "Virgo";
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (day <= 23) {
|
||||
starSign = "Virgo";
|
||||
} else {
|
||||
starSign = "Libra";
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if (day <= 23) {
|
||||
starSign = "Libra";
|
||||
} else {
|
||||
starSign = "Scorpio";
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
if (day <= 22) {
|
||||
starSign = "Scorpio";
|
||||
} else {
|
||||
starSign = "Sagittarius";
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
if (day <= 21) {
|
||||
starSign = "Sagittarius";
|
||||
} else {
|
||||
starSign = "Capricorn";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
starSign = "Invalid month";
|
||||
}
|
||||
|
||||
System.out.println("with the birthday " + day + ". " + month + " your assigned star sign is: " + starSign);
|
||||
}
|
||||
|
||||
public static boolean validateDate(int day, int month) {
|
||||
switch (month) {
|
||||
case 1, 3, 5, 7, 8, 10, 12:
|
||||
return (day <= 31 && day > 0);
|
||||
case 4, 6, 9, 11:
|
||||
return (day <= 30 && day > 0);
|
||||
case 2:
|
||||
return (day <= 29 && day > 0);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue