Help needed ASAP! Language: JAVA Fill in your code for the following program that takes two words as input from the keyboard, representing a user ID and a password, then the program does the following: If the user ID and the password match “admin” and “open”, respectively, then output “Welcome”. If the user ID matches “admin” and the password does not match “open”, output “Wrong password”. If the password matches “open” and the user ID does not match “admin”, output “Wrong user ID”. Otherwise, output “Sorry, wrong ID and password”.
Addition of Two Numbers
Adding two numbers in programming is essentially the same as adding two numbers in general arithmetic. A significant difference is that in programming, you need to pay attention to the data type of the variable that will hold the sum of two numbers.
C++
C++ is a general-purpose hybrid language, which supports both OOPs and procedural language designed and developed by Bjarne Stroustrup. It began in 1979 as “C with Classes” at Bell Labs and first appeared in the year 1985 as C++. It is the superset of C programming language, because it uses most of the C code syntax. Due to its hybrid functionality, it used to develop embedded systems, operating systems, web browser, GUI and video games.
Help needed ASAP!
Language: JAVA
Fill in your code for the following
-
If the user ID and the password match “admin” and “open”, respectively, then output “Welcome”.
-
If the user ID matches “admin” and the password does not match “open”, output “Wrong password”.
-
If the password matches “open” and the user ID does not match “admin”, output “Wrong user ID”.
-
Otherwise, output “Sorry, wrong ID and password”.
import java.util.Scanner;
public class Login{
public static void main(String[] args){
Scanner scan = ____ Scanner(________);//instantiate a Scanner object
String userID = scan._________; // read the user ID
String password = scan.__________; // read the password
if(________________________________)
{
System.out.println("Welcome");
}
else if(___________________________)
{
System.out.println("Wrong password");
}
else if(____________________________)
{
System.out.println("Wrong user ID");
}
else
{
System.out.println("Sorry, wrong user ID and password");
}
}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images