<>@ Create object properties , method .
package xt; import java.util.Scanner; public class Website { // Create operator class static
String WebsiteName; // Operator name private String name; // User name private String password
; // password private double balance ; // Account balance private double turnover ; // a turnover private
boolean authenticated; // Boolean verification // Welcome statement static void welcome() {
System.out.println ("----------" + " Welcome to " +WebsiteName + "-----------"); }
public Website(String name,String password,double turnover) { // TODO
Auto-generated method stub this.name = name; this.password = password;
this.turnover = turnover; this.balance = turnover - 10; this.authenticated =
false; System.out.println (name+" Account opened successfully , The account balance is "+balance) ; } public boolean
getAuthenticated() { return this.authenticated; } public boolean
authenticate(String pwd) { if (pwd.equals(this.password)) { this.authenticated
= true; } return this.authenticated; } public void deposit (double turnover) {
Scanner sc=new Scanner(System.in); System.out.println(" Please input deposit :");
turnover=sc.nextDouble(); System.out.println(turnover); balance = balance +
turnover; System.out.println(name+ " Hello! , Your account Deposited "+turnover+" element ," + " Current balance
"+balance+ " element "); } public void withdrawal (double turnover) { if
(!this.getAuthenticated()) { // System.out.println(" The password you entered is incorrect !");
System.out.println("Unauthorised operation!"); // Could throw an exception here
return; } // Judge the balance if (balance - turnover > 0 ) { this.balance =balance-
turnover; System.out.println(name+" Hello! , You have successfully handled the broadband Internet service for half a year , Thank you for your use , Through your account Handle the business
Consumed "+turnover+" element , "+ " Current balance "+balance+" element "+ "\n Welcome to China Unicom , Thank you for your support , We will serve you better !")
; }else { System.out.println( name+" Hello! , You have successfully handled the broadband Internet service for half a year , Thank you for your use , Through your account Handle the business
Consumed "+turnover+" element , "+ " The current balance is "+balance +"
element , Your phone bill is about to run out , In order not to affect your communication , Please pay the phone bill in time "+"\n Welcome to China Unicom , Thank you for your support , We will serve you better !") ; } } static
void welcomeNext() { System.out.println("---------- "+ " Please take your belongings with you , looking forward to your next visit "
+WebsiteName+" ------------"); } }
<>@ Access by class name , Create objects and assign values .
package xt; import java.util.Scanner; public class text01 { public static void
main(String[] args) { // TODO Auto-generated method stub Website.WebsiteName =
" China Unicom "; // Define an operator Website.welcome(); // Call welcome Website website= new
Website(" Chen Yihan, my goddess ","654321", 200.0); // Construct method for user operation website.deposit(500.0);
// Deposit operation Scanner s = new Scanner(System.in); int counter = 0; while (counter <
3 && !website.getAuthenticated()) { System.out.println(" Online business Please input a password Please
input your password."); if (website.authenticate(s.nextLine())) { break; } ++
counter; System.out.println("\t The password is incorrect \n Incorrect password."); } if
(!website.getAuthenticated()) { System.out.println(" Login failed " + "Failed to login!"
+ "\n close program "); return; } // Password error , Entry failure website.withdrawal(200.0); // Sorry, your credit is running low , //
website.withdrawal(100.0); // The password is correct , The balance is sufficient website.welcomeNext(); } }
Achieve results

It is used in the this Keyword call ,if…else Judgment sentence ,while…if… Cipher cycle .


System project for the first time , There are many projects that have been done by our predecessors , This time I want to make a different one . Now this project is not complete enough , Some modules are not perfect , Use this study to verify your harvest . There is still a lot of grammar to learn .

Technology
©2019-2020 Toolsou All rights reserved,
springboot Multi profile configuration unity Get the car speed and forward or backward element-ui+vue-treeselect Verification of drop down box uboot set up nfs parameter ——linux kernel use nfs Mode to load the root file system rootfs( Six ) 0032- How to CDH Enable Kerberos Installation and use Sentry( Two )Go language Array initialization and basic operations Theory and formula derivation of univariate linear regression and multiple linear regression ( Essence 2020 year 6 month 3 Daily update ) TypeScript Detailed explanation of Chinese interface Online troubleshooting HTTP Status code ——415 and 406( Essence )2020 year 7 month 13 day Wechat applet Inter communication page