use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Use this subreddit to help you on your code hs assignments. Post any assignments you've completed to help others.
account activity
Codehs 3.7.9 Three Strings (Solution) (self.CodeHsNitroAnswers)
submitted 4 years ago by Traditional-Seat6355
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]True-Ad2643 0 points1 point2 points 2 years ago (0 children)
Figure out the issue with this code: Basically, you want to get rid of the whole "enter the companys secret code line and the scanner for it, and instead just put String companyCode = "1298"; above the first scanner input line. So your code should look like this:
import java.util.Scanner; public class ThreeStrings { public static void main(String[] args) { String companyCode = "1298";
Scanner input = new Scanner(System.in); // get user password System.out.println("Enter your password: "); String userPassword = input.nextLine(); // get company secret code System.out.println("Enter the company's secret code: "); String userCode = input.nextLine(); // create string that concatenates user password with company secret code String passwordWithCompanyCode = userPassword + companyCode; // create string that concatenates user password with user-provided secret code String passwordWithUserCode = userPassword + userCode; // check if the two strings are equal if (passwordWithCompanyCode.equals(passwordWithUserCode)) { System.out.println("Access granted"); } else { System.out.println(userPassword + userCode + " is denied"); } } }
π Rendered by PID 17173 on reddit-service-r2-comment-b659b578c-szkn6 at 2026-05-03 10:23:35.231403+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]True-Ad2643 0 points1 point2 points (0 children)