I am currently trying to learn Java and one of the things it wants me to do is use if statements. I am kind of stuck on this.
I am supposed to change part of my already established basic Hello program to add this at the end..
a. Instead of asking the user's age, instead ask "How much love do you need?" There are "3 use case" scenarios to consider: i. Use Case 1: User enters 0 or a negative number 1. Print out the message "Everybody needs some love!" ii. Use Case 2: User enters a number bigger than 10 1. Print out the message "You cannot handle that much love!" iii. Use Case 3: User enters a number between 1 and 9 1. Use a loop to count from 1 to the number entered, and print each "I love you" number "way" or "ways" according to English grammar, on a separate line. a. Example: If 2 is entered, then print: I love you 1 way I love you 2 ways
Any help here would be appreciated.
Hunter Moore
do your own homework, Pajeet
Michael Baker
I actually came here before when I was learning Python and Sup Forums was very helpful and set me on the right track. I have looked up using if statements and I just do not get how to do it.
Aiden Martin
If (condition) { Code } else if (another condition) { Code } else if (third condition) { Code } else { //this happens of none of the above conditions pass Code }
Angel Davis
You don't learn Java you just get continuously better at learning how to google things. Learn a real language and leave Java to Pajeet.
Kayden Roberts
I may be missing something but this is what I got when I tried to put in what I thought was right.
Jacob Baker
Kill yourself
Luis Edwards
it works the same damn way as python, just formatted with parenthesis and brackets. Use the damn name variable to do the checks in the if statement.
Jayden Thomas
Lmao
Wyatt Sanchez
Needs more semicolons dude
Angel Miller
Why did I waste my time...
Bentley Green
This
The compiler is even telling you this
Colton Peterson
If you're going to skip class, just do yourself a favor and drop out now. You won't make it.
Kayden Long
Check his condition statements too. Lel.
Sebastian Perez
In the off chance you're not a troll, your condition statements are wrong.
Jason Long
By the way, your condition statements should look like this.
public static void main(String[] args) { Scanner scanner = new Scanner(new InputStreamReader(System.in)); System.out.println("Please enter number of penis: "); int input = scanner.nextInt(); if(input > 10) { System.out.println("Your ass cannot handle that many penises"); } else if(input
Nolan Hughes
it needs to talk about love not penises can you rewrite it?
James Baker
Create an integer to hold the love needed value, read it in the same way you read in age and name. For less than 0: if(love=10) if(love>0 && love
Kayden Mitchell
Do it yourself faggot.
Leo Murphy
Quality thread, OP, sides are broken.
Thomas Foster
Holy shit use switch ffs Oh
Jason Russell
Oh fuck this is golden
Grayson Green
r8 h8 masterb8
Wyatt Rivera
> >Oh fuck this is golden shut up pajeet, first learn some English
Easton Mitchell
thats not how you use if-statements.... like at all. some pajeet on youtube could teach you this shit in like 5 minutes, fucking idiot.