真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

會(huì)員積分java代碼 積分代碼實(shí)現(xiàn)

急!Java 練習(xí) 根據(jù)會(huì)員積分,計(jì)算所享受的折扣。

package com.javaeye.morflame;

創(chuàng)新互聯(lián)公司專注于襄州網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠(chéng)為您提供襄州營(yíng)銷型網(wǎng)站建設(shè),襄州網(wǎng)站制作、襄州網(wǎng)頁設(shè)計(jì)、襄州網(wǎng)站官網(wǎng)定制、重慶小程序開發(fā)服務(wù),打造襄州網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供襄州網(wǎng)站排名全網(wǎng)營(yíng)銷落地服務(wù)。

import java.util.Scanner;

public class Test {

public static void main(String[] args) {

Scanner in=new Scanner(System.in);

System.out.print("輸入積分:");

int a=in.nextInt();

int result=zhekou(a);

System.out.println("折扣為"+result+"折");

}

//求折扣的函數(shù)

private static int zhekou(int a) {

int result=0;

if(a2000)

{

result= 9;

}

else if(a4000){

result= 8;

}

else if(a8000){

result= 7;

}

else if(a=8000){

result= 6;

}

else{

System.out.println("輸入的積分不在范圍內(nèi)!");

}

return result;

}

}

如果樓主覺得還不行,自己在這個(gè)基礎(chǔ)上改一下下代碼肯定就OK了

JAVA 大家?guī)兔匆幌略趺醋?會(huì)員積分x x

Java程序:

import java.util.Scanner;

public class xll {

public static void main(String[] args) {

int score;

double count = 1.0;

Scanner input = new Scanner(System.in);

System.out.println("請(qǐng)輸入會(huì)員積分:");

score = input.nextInt();

if(score 2000)

count = 0.9;

else if(score 4000)

count = 0.8;

else if(score 8000)

count = 0.7;

System.out.println("該會(huì)員享受的折扣是:");

System.out.println(count + "折");

}

}

運(yùn)行測(cè)試:

請(qǐng)輸入會(huì)員積分:

5000

該會(huì)員享受的折扣是:

0.7折

請(qǐng)輸入會(huì)員積分:

3420

該會(huì)員享受的折扣是:

0.8折

有一問題,如果積分超過8000是幾折?

java輸入會(huì)員編號(hào)和會(huì)員積分,編號(hào)相同則停止輸入讓后輸出的所有會(huì)員編號(hào)和積

public static void main(String args[]) {

//聲明一個(gè)存放會(huì)員信息的list集合,會(huì)員信息由編號(hào)和積分組成一個(gè)map

ArrayListMapObject, String list = new ArrayListMapObject, String();

boolean flag=false;//沒有找到相同的會(huì)員編號(hào)

while(1==1){

Scanner scan = new Scanner(System.in);

System.out.println("請(qǐng)輸入會(huì)員編號(hào):");

String bh = scan.nextLine();

System.out.println("請(qǐng)輸入會(huì)員積分:");

String jf = scan.nextLine();

if(list!=null list.size()0){

for (int i = 0; i list.size(); i++) {//循環(huán)存放歷史輸入會(huì)員信息的集合

MapObject, String m = list.get(i);

if(bh.equals(m.get("bh"))){//將當(dāng)前輸入的會(huì)員編號(hào)和已輸入的相同時(shí)

flag=true;//已找到

}

}

}

if (flag==true) {//已找到

System.out.println("所有輸入的會(huì)員信息如下:");

for (int i = 0; i list.size(); i++) {//輸出所有的會(huì)員信息

MapObject, String m = list.get(i);

System.out.println("會(huì)員編號(hào):"+m.get("bh")+"-----會(huì)員積分:"+m.get("jf")+"");

}

//結(jié)束循環(huán)輸入

break;

}else{//沒有找到相同信息時(shí),存放進(jìn)list集合

MapObject, String map = new HashMapObject, String();

map.put("bh", bh);

map.put("jf", jf);

list.add(map);//將輸入的會(huì)員信息存放入list

}

}

}

急!Java 練習(xí) 根據(jù)會(huì)員積分,計(jì)算所享受的折扣.

import java.util.Scanner;

public class Test1 {

public static void main(String[] args) {

System.out.println("請(qǐng)輸入會(huì)員積分:");

Scanner sc=new Scanner(System.in);

int a=sc.nextInt();

sc.close();

if(a200){

System.out.println("該會(huì)員享受的折扣是:0.9");

}else if(a=2000a=4000){

System.out.println("該會(huì)員享受的折扣是:0.8");

}else if(a=4000a=8000){

System.out.println("該會(huì)員享受的折扣是:0.7");

}else if(a=8000){

System.out.println("該會(huì)員享受的折扣是:0.6");

}

}

}

求Accp6.0java第十四章練習(xí)題一二的代碼!

我自己寫的,運(yùn)行沒問題,如果有小問題,歡迎指出

練習(xí)一:

Customer類:

package com.wxws.sms;

public class Customer {

/**

* @param args

*/

String CustNumber;

int CustPoint;

}

--------------------------------分隔符------------------------------------

CustManager類:

package com.wxws.sms;

import java.util.*;

public class CustManager {

Customer customers[]=new Customer[100];

public void CustAdd(Customer cust) {

// TODO Auto-generated constructor stub

for(int i=0;icustomers.length;i++){

if(customers[i]==null){

customers[i]=cust;

break;

}

}

}

public void showCustomer(){

System.out.println("***Customers List***");

System.out.println("number\tpoint");

for(int i=0;icustomers.length;i++){

if(customers[i]!=null){

System.out.println(customers[i].CustNumber+"\t"+customers[i].CustPoint);

}

}

}

/**

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

Customer run=new Customer();

CustManager move=new CustManager();

@SuppressWarnings("resource")

Scanner input=new Scanner(System.in);

System.out.print("Please input your Vip number:");

run.CustNumber=input.next();

System.out.print("Please input your Vip point:");

run.CustPoint=input.nextInt();

move.CustAdd(run);

move.showCustomer();

}

}

---------------------------------------------分割符號(hào)---------------------------------------------------

練習(xí)二(將Customer類的屬性改成數(shù)組):

package com.wxws.sms;

public class Customer {

/**

* @param args

*/

String CustNumber[]=new String[100];

int CustPoint[]=new int[100];

}

---------------------------------------------分割符號(hào)---------------------------------------------------

package com.wxws.sms;

import java.util.*;

public class CustManager {

Customer customers[]=new Customer[100];

public void CustAdd(Customer cust) {

// TODO Auto-generated constructor stub

for(int i=0;icustomers.length;i++){

if(customers[i]==null){

customers[i]=cust;

break;

}

}

}

public void showCustomer(){

System.out.println("***Customers List***");

System.out.println("number\tpoint");

for(int i=0;icustomers.length;i++){

if(customers[i]!=null){

System.out.println(customers[i].CustNumber[i]+"\t"+customers[i].CustPoint[i]);

}

}

}

public int searchScore(String custNo){

int point=1;

for(int i=0;icustomers.length;i++){

if(customers[i]!=null){

if((customers[i].CustNumber[i]).equals(custNo)){

System.out.println("The number of Vip's point is:"+customers[i].CustPoint[i]);

point=customers[i].CustPoint[i];

}

}

}

return point;

}

/**

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

Customer run=new Customer();

CustManager move=new CustManager();

@SuppressWarnings("resource")

Scanner input=new Scanner(System.in);

for(int i=0;i4;i++){

System.out.print("Please input your Vip number:");

run.CustNumber[i]=input.next();

System.out.print("Please input your Vip point:");

run.CustPoint[i]=input.nextInt();

move.CustAdd(run);

}

move.showCustomer();

System.out.print("Please input the Vip number you want to check:");

String custNum=input.next();

move.searchScore(custNum);

}

}

java 循環(huán)輸入多個(gè)會(huì)員信息 怎樣根據(jù)會(huì)員編號(hào)查找會(huì)員積分?

import?java.util.ArrayList;

import?java.util.List;

public?class?Test?{

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

ListUser?userList?=?new?ArrayListUser();

for(int?i=0;i10;i++)?{

userList.add(new?User(String.valueOf(i),i));

}

//查找會(huì)員編號(hào)為3的積分

for(User?u?:?userList)?{

if("3".equals(u.getId().toString()))?{

System.out.println("編號(hào)"+u.getId()+"會(huì)員的積分為:"+u.getPoint());

}

}

}

}

class??User?{

private?String?id;//會(huì)員編號(hào)

private?int?point;//積分

public?User(String?id,int?point)?{

this.id?=?id;

this.point?=?point;

}

public?String?getId()?{

return?id;

}

public?void?setId(String?id)?{

this.id?=?id;

}

public?int?getPoint()?{

return?point;

}

public?void?setPoint(int?point)?{

this.point?=?point;

}

}


新聞名稱:會(huì)員積分java代碼 積分代碼實(shí)現(xiàn)
標(biāo)題鏈接:http://weahome.cn/article/hjhjgg.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部