第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Q : 租車計(jì)算器 | 使用哨兵值循環(huán)

Q : 租車計(jì)算器 | 使用哨兵值循環(huán)

一只萌萌小番薯 2021-12-10 16:38:27
我很困惑我是否遵循了這一權(quán)利,并且在尋求安慰和一些幫助。所以我的主要問題是我是否遵循我的導(dǎo)師問題:當(dāng)他說使用哨兵值循環(huán)構(gòu)建它時?其次,如何將總計(jì)四舍五入到兩位小數(shù)?如果它有助于我的任務(wù)是這樣的:說明:使用哨兵值循環(huán)。詢問每個用戶:車輛類型(可以使用字符串以外的其他東西,例如:1 表示經(jīng)濟(jì)型,2 表示轎車等) 租用天數(shù) 計(jì)算(對于每個客戶):租金、稅費(fèi)、應(yīng)付總額。有三種不同的租賃選擇,價格不同:經(jīng)濟(jì)型 @ 31.76、轎車 @ 40.32、SUV @ 47.56。[注意:僅考慮全天單位(無小時費(fèi)率)]。銷售稅 = TOTAL 的 6%。創(chuàng)建匯總數(shù)據(jù):客戶數(shù)量 收集到的總金額。此外,包括 IPO、算法和桌面檢查值(設(shè)計(jì)文檔)。{我的設(shè)計(jì)和進(jìn)度}包易派;導(dǎo)入 java.util.*; 導(dǎo)入 java.lang.Math;公共課嗯{int count = 0;static int days;static double DailyFee, NontaxTotal, CarType, Total;public static void main(String[] args) {    Scanner keyboard = new Scanner(System.in);    System.out.print("What vehical would you like to rent?\n");    System.out.println("Enter 1 for an economy car\n");    System.out.println("Enter 2 for a sedan car\n");    System.out.println("Enter 3 for an SUV");    CarType = keyboard.nextInt();    if (CarType == 1)          DailyFee=31.76;        else if(CarType == 2)          DailyFee=40.32;        else if(CarType == 3)          DailyFee=43.50;    System.out.print("Please enter the number of days rented. (Example; 3) : ");    days = keyboard.nextInt();    NontaxTotal = (DailyFee * days);    Total = (NontaxTotal * 1.06);    System.out.printf("The total amount due is $" + Total);}}
查看完整描述

1 回答

?
守著星空守著你

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超8個贊

布蘭登,沒有哨兵循環(huán)。在我看來,這就是你想要的程序,


import java.util.*;


public class Stack3{

public static void main(String []args){

    int count=0;

    int days;

    double DailyFee=0, NontaxTotal, CarType, Total,FullTotal=0;

    Scanner in=new Scanner(System.in);

    System.out.println("If there are any customer press 1 else press 0");

    int cus=in.nextInt();

    // this is sentinel loop

    while(cus!=0){

        count++;

        System.out.print("What vehical would you like to rent?\n");

        System.out.println("Enter 1 for an economy car\n");

        System.out.println("Enter 2 for a sedan car\n");

        System.out.println("Enter 3 for an SUV");

        CarType = in.nextInt();

        if (CarType == 1)

              DailyFee=31.76;

        else if(CarType == 2)

              DailyFee=40.32;

        else if(CarType == 3)

              DailyFee=43.50;


        System.out.print("Please enter the number of days rented. (Example; 3) : ");

        days = in.nextInt();

        double x=days;

        NontaxTotal = (DailyFee * x);

        Total = (NontaxTotal * 1.06);

        FullTotal+=Total;

        //included 2 decimals only

        System.out.printf("The total amount due is $ %.2f \n",Total);


        System.out.println("If there are any customer press 1 else press 0");

        cus=in.nextInt();

    }

    System.out.println("Count of customers :- "+count);

    System.out.printf("Total of the Day :- %.2f",FullTotal);

}

}


查看完整回答
反對 回復(fù) 2021-12-10
  • 1 回答
  • 0 關(guān)注
  • 173 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號