hi, i decided to try this assignment for fun and stuck with last conditionproblem:
When you go on a date, you rate your date's fashion sense on a scale from 0 to 10. As a general rule, if the rating is 8 or more, then you will consider going out again with the same person. However, if your date's parents are wealthy, you will consider going out again with him or her if the rating is 7 or more.
If the int r contains your date's rating from 0 to 10 and the boolean w contains true if and only if your date's parents are wealthy, write code that will set d to true if and only if you will consider going on another date with the same person.
import java.util.Scanner; public class dating { public static void main(String[] args) { System.out.print("enter your date's fashion sense: "); Scanner userInput = new Scanner(System.in); String r = userInput.next(); int rate = Integer.parseInt(r); System.out.println("your rating is: " + r); int pass = 8; if (rate >= pass) { System.out.println("you will consider going out with your date again."); } if (rate == 7) { System.out.print("his/her parents are wealthy? y/n: "); String d = userInput.next(); if (d == "y") { System.out.println("you will consider going out with your date again."); } } else System.out.print("you will not consider going out with your date again."); }
any tips to improvise?enter your date's fashion sense: 7
your rating is: 7
his/her parents are wealthy? y/n: y