欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

java電話卡設(shè)計代碼,java電話卡設(shè)計代碼大全

有九道JAVA與面向?qū)ο蟮膶嵺`題目不會做啊!求高手把代碼給我下可以嗎?謝謝啦

7.

網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、微信小程序定制開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了呼圖壁免費(fèi)建站歡迎大家使用!

!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?";quot;

html

head

title計算器/title

style?type="text/css"

input{

height:1.5em;}

.style1{

font-size:18px}

.height{

height:1.2em;}

/style

script?language="javascript"

function?computer(op){

var?num1,num2,result;

num1?=?parseFloat(document.form1.textname1.value);

num2?=?parseFloat(document.form1.textname2.value);

if(op=="+")

result?=?num1?+?num2;

document.form1.textResult.value=result;

if(op=="-")

result?=?num1?-?num2;

document.form1.textResult.value?=?result;

if(op=="*")

result?=?num1?*?num2;

document.form1.textResult.value?=?result;

if(op=="/"??num2!=0)

result?=?num1/num2;

document.form1.textResult.value?=?result;

}

/script

/head

body

form?name="form1"

center

table?width="500"?height="300"?border="0"?background="images/water001.jpg"

tr

td??width="183"?height="61"img?src="images/baidu_logo.gif"??width="182"?height="54"http://td

td?width="219"span?class="style1"百度計算器/span/td

/tr

tr

td?colspan="2"span?class="style1"第一個數(shù):input?type="text"?name="textname1"http://span/td

/tr

tr

td?colspan="2"span?class="style1"第二個數(shù):input?type="text"?name="textname2"http://span/td

/tr

tr

td?colspan="2"

input?class="height"?type="button"?value="??+??"?onClick="computer('+')"/nbsp;nbsp;nbsp;

input?class="height"?type="button"?value="??-??"?onClick="computer('-')"/nbsp;nbsp;nbsp;

input?class="height"?type="button"?value="??*??"?onClick="computer('*')"/nbsp;nbsp;nbsp;

input?class="height"?type="button"?value="??/??"?onClick="computer('/')"/

/td

/tr

tr

td?colspan="2"span?class="style1"計算結(jié)果:input?type="text"?name="textResult"http://span/td

/tr

/table

/center

/form

/body

/html

用java編寫一個電話計費(fèi)卡程序

import?java.util.Scanner;

public?class?PhoneCard?{

private?final?int?id;?//?卡號

private?final?int?password;?//密碼

private?double?cash;?//剩余金額

private?double?cashPerMin?=?0.2;//?每分鐘收費(fèi)

private?Scanner?sc?=?new?Scanner(System.in);?

public?PhoneCard(int?id,int?password,double?cash)?{

this.id?=?id;

this.password?=?password;

this.cash?=?cash;

}

/**

?*?撥號計費(fèi)

?*?@param?time?撥號時間?單位分鐘

?*?返回剩余金額

?*/

public?double?callSomeone(double?time)?{

System.out.println("請輸入卡號和密碼,用空格隔開");

int?id?=?sc.nextInt();

int?pw?=?sc.nextInt();

if(this.id?==?id??this.password?==?pw)?{

this.cash?=?this.cash?-?(double)time?*?cashPerMin;

return?cash;

}?else?{

System.out.println("密碼錯誤");

return?-1;

}

}

}

public?class?TestPhoneCard?{

public?static?void?main(String[]?args)?{

PhoneCard?pc?=?new?PhoneCard(1,?1,?100);?//初始化,卡號,密碼,余額

double?money?=?pc.callSomeone(10);?//撥打10分鐘

System.out.println("余額為"?+?money?+?"元");

money?=?pc.callSomeone(90);?//繼續(xù)撥打

System.out.println("余額為"?+?money?+?"元");

}

}

不知道為什么沒人做

求一個記錄人名和電話號碼功能的Java應(yīng)用程序

import java.io.BufferedReader;

import java.io.BufferedWriter;

import java.io.File;

import java.io.FileReader;

import java.io.FileWriter;

import java.util.Scanner;

public class Phones {

public static final String filename = "phonesnumber.txt";

public static void main(String[] args) throws Exception {

Phones p = new Phones();

p.getPhones();

while (true)

p.addPhone();

}

private String getInput(String tip) {

System.out.print(tip);

Scanner sc = new Scanner(System.in);

return sc.next();

}

public void getPhones() throws Exception {

File file = new File(filename);

if (!file.exists()) {

file.createNewFile();

return;

}

BufferedReader br = new BufferedReader(new FileReader(file));

String line = null;

while ((line = br.readLine()) != null) {

System.out.println(line);

}

br.close();

}

public void addPhone() throws Exception {

String name = getInput("請輸入名字:");

String phone = getInput("請輸入電話號碼:");

BufferedWriter bw = new BufferedWriter(new FileWriter(

new File(filename), true));

bw.write(name + " " + phone + "\r\n");

bw.close();

}

}

JAVA小程序 設(shè)計一個電話卡

class PhoneCard

{

long can;

int ps;

double ba;

String con;

boolean connected=false;

PhoneCard(long cardNumber, int password,double balance,String connectNumber)

{

can=cardNumber;

ps=password;

ba=balance;

con=connectNumber;

}

void performConnection(long cardNumber, int password)

{

if(can!=cardNumber)

System.out.println("號碼不對");

else if(can==cardNumberps!=password)

System.out.println("密碼不對");

else if(can==cardNumberps==password)

{

this.getBalance();

connected=true;

this.performDial();

}

}

public double getBalance()

{

if(ba=0)

{

System.out.println("余額不足!");

System.exit(0);

}

else

return ba;

return ba;

}

double performDial()

{

System.out.println("本次通話將扣除0.5元");

return ba-0.5;

}

}

public class call1

{

public static void main(String[] args)

{

PhoneCard phonecard=new PhoneCard(88888888,123456,100.00,"110");

phonecard.performConnection(11111111,45);

phonecard.performConnection(88888888,45);

phonecard.performConnection(88888888,123456);

phonecard.getBalance();

}

};

java智能卡作業(yè),電子錢包,用eclipse能運(yùn)行的代碼

//測試類

public class Util {

public static void main(String[] args) {

DianZiMoneyBao d1 = new DianZiMoneyBao(20,"123");

d1.syso(d1);

}

}

class DianZiMoneyBao{

public float money;//錢

public String miyue;

public DianZiMoneyBao(float money, String miyue){

this.money = money;

this.miyue = miyue;

}

//鍵盤輸入方法

public static void syso(DianZiMoneyBao dzmb){

java.util.Scanner sc = new java.util.Scanner(System.in);

System.out.println("請輸入功能,(1,加錢 2,減錢)");

String num = sc.next();

try{

if("1".trim().equals(num)){

System.out.println("請輸入密鑰....");

String miyue = sc.next();

if(miyue.equals(dzmb.miyue)){

System.out.println("卡內(nèi)余額:" + dzmb.money+"元。");

System.out.println("請輸入加錢金額,例如:20.05 / 20");

float f = sc.nextFloat();

dzmb.add(f);

}else{

System.out.println("對不起,輸入密鑰有誤~!");

}

}else if("2".trim().equals(num)){

System.out.println("請輸入密鑰....");

String miyue = sc.next();

if(miyue.equals(dzmb.miyue)){

System.out.println("卡內(nèi)余額:" + dzmb.money+"元。");

System.out.println("請輸入提現(xiàn)金額,例如:20.05 / 20");

float f = sc.nextFloat();

dzmb.jian(f);

}else{

System.out.println("對不起,輸入密鑰有誤~!");

}

}else{

System.out.println("對不起,輸入類別錯誤~!");

}

}catch(Exception e){

System.out.println("請輸入正確的金額...");

}

}

//加錢方法

public void add(float num){

System.out.println("加錢后余額:" + (this.money + num));

}

//減錢方法

public void jian(float num){

if(this.money - num = 0){

System.out.println("對不起,卡內(nèi)余額為"+this.money+"元,不能提現(xiàn)~!");

}else{

System.out.println("提取后余額:" + (this.money - num));

}

}

}

JAVA設(shè)計查詢用戶電話

這其實關(guān)系到你的電話是如何人存儲的,于是我只能提供一個示范代碼:

package?test;

import?java.util.HashMap;

import?java.util.Map;

import?java.util.Scanner;

public?class?Query?{

private?MapString,?String?phonebook;

public?Query()?{

phonebook?=?new?HashMapString,?String();

phonebook.put("qcq",?"15363849333");

phonebook.put("qcq1",?"15363849335");

phonebook.put("qcq2",?"15363849338");

phonebook.put("qcq3",?"15363849353");

}

public?Query(MapString,?String?phonebook)?{

this.phonebook?=?phonebook;

}

public?String?getPhoneByName(String?name)?{

if?(phonebook.containsKey(name))?{

return?phonebook.get(name);

}?else?{

return?null;

}

}

public?static?void?main(String[]?args)?{

Scanner?in?=?new?Scanner(System.in);

Query?query?=?new?Query();

System.out.println("please?input?the?query?name");

String?name?=?in.next();

System.out.println(query.getPhoneByName(name));

if?(null?!=?in)?{

in.close();

}

}

}

網(wǎng)頁名稱:java電話卡設(shè)計代碼,java電話卡設(shè)計代碼大全
轉(zhuǎn)載來于:http://chinadenli.net/article8/dsijeip.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站品牌網(wǎng)站設(shè)計App開發(fā)網(wǎng)站營銷微信小程序App設(shè)計

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司