Lab Activities 4 august 2010
Write a Java program to read a password. If the password equals to 1234 then print out “Your password is accepted”. Otherwise print “Your password is Not Accepted”.
Flowchart
Java Program
/**
* @(#)Lab3_1.java
*
* Lab3_1 application
*
* @author
* @version 1.00 2010/8/4
*/
import javax.swing.*;
public class Lab3_1 {
public static void main(String[] args) {
// TODO, add your application code
int password;
String answerString = JOptionPane.showInputDialog ("Please enter your password");
password = Integer.parseInt(answerString);
if(password == 1234)
JOptionPane.showMessageDialog(null,"Your Password is Accepted" );
else
JOptionPane.showMessageDialog(null,"Your Password is NOT Accepted" );
}
}
Subscribe to:
Post Comments (Atom)
Cara download Installer windows 10 dalam format ISO
1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan. ...
-
ANSWERS TO CHAPTER EXERCISES (CHAPTER 8) Review Questions 1. List and describe various types of output, including technolog...
-
Based on real life scenario on any local company/ organization which you are very familiar, define the problem that could be addressed thr...
-
A. Response to the following statements by circling either T (TRUE) or F (FALSE). [10M] I. 1. Java enables users...
No comments:
Post a Comment