第十五章上机练习4

//上机练习4
import java.util.Scanner;
public class ZXC {
	String[] goods=new String[]{"电风扇","洗衣机","电视机","冰箱","空调机"};
	double[] price=new double[]{124.23,4500,8800.9,5000,4456};
	public boolean login(){
		boolean flag=false;
		Scanner input=new Scanner(System.in);
		System.out.println("请输入用户名:");
		String name=input.next();
		System.out.println("请输入密码:");
		String pwd=input.next();
		if(name.equals("TOM")&&pwd.equals("12354")){
			System.out.println("登陆成功!  ");
			flag=true;
		}else{
			System.out.println("用户名或密码不正确,登陆失败!");
		}
		return flag;
	}
	public StringBuffer change(String string){
		StringBuffer str=new StringBuffer(String.valueOf(string));
		for(int i=str.indexOf(".")-3;i>0;i=i-3){
			str.insert(i, ',');
		}
		return str;
	}
	public void shows(){
		System.out.println("*****欢迎进入商品批发城*******");
		System.out.println("\t编号\t商品\t价格\n");
		for(int i=0;i

你可能感兴趣的:(第十五章上机练习4)