In Windows, go to the folder in which you would like to download this repository, click on the address bar at the top
and type cmd.exe
. This will open up the command line terminal, where you will enter the following commands:
git clone https://github.com/Compec/java-2018-w1-assignment
Launch IntelliJ IDEA
and open the project by selecting the folder where you downloaded the project.
Simply press on the green button Clone or Download
in top-right corner of this page and press Download ZIP
.
Download the ZIP file then extract it with your zip program (Winrar, 7zip ...)
I do not have a mac/linux machine so I prefer not to give instructions :) The steps should be very similar though.
Write a Java program to print Hello
on screen and then print your name on a separate line. Write it in the Main.java
inside src
folder.
Hello
Mehdi Saffar
A) Make the program ask the user for its name and display it
Example:
Hello
What is your name? __Mehdi Saffar__
Hello Mehdi Saffar
B) Make the program ask the user for its age, calculate its birth year from the age and display it
- Try having a function called
calculateBirthYear
that takes the current year and the age of the user as input and returns the birth year
Example:
Hello
What is your name? Mehdi Saffar
Hello Mehdi Saffar, what is your age? 22
You are born in 1996
C) Ask the user for its GPA and display a message according to his GPA
- There must be at least 3 different messages
- We haven't learned how to input decimal numbers from the console. Try looking in google how to do that. Example search:
java scanner console double
Example:
Hello
What is your name? Mehdi Saffar
Hello Mehdi Saffar, what is your age? 22
You are born in 1996
What is your GPA? 3.4
Nice GPA buddy ;)
Mehdi Saffar - LinkedIn