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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

類型開頭非法(其他)

類型開頭非法(其他)

鳳凰求蠱 2023-11-01 22:07:42
我正在為我的 CS 110 課程做一個(gè)實(shí)驗(yàn),有一行代碼無法編譯。我確保它與參考材料上的模板相匹配。我不確定重現(xiàn)該問題需要多少代碼,因此我提供了所有代碼并 //ed 出現(xiàn)問題的位置。更具體地說,它位于第 42 行。錯(cuò)誤顯示“錯(cuò)誤:類型非法開始”。我已經(jīng)嘗試刪除一些我認(rèn)為多余的括號(hào),但彈出了更多錯(cuò)誤。/* Author: Collin Walsh   Date: 10/15/2019   File name: NstedIfs.java*/import java.util.Scanner;public class NestedIfs {    //main    public static void main(String[] args) {        Scanner keyboard = new Scanner (System.in);        double outsideTempF;        System.out.println("What is the temperature outside? Input a value and press enter ");        outsideTempF =  keyboard.nextDouble();        Scanner input = new Scanner (System.in);        int raining = 0;        System.out.println("If it is raining, enter the number 1. Then press enter");        raining = keyboard.nextInt();        //indicate what clothing to wear, based on temp           if (outsideTempF > 70) {            if (raining == 1) {                System.outprintln("Wear t-shirt, shorts, sandals, and an unbrella");            }else{                      System.out.println("Wear t-shirt, shorts, and sandals.");            }           } else if (outsideTempF <= 30) {            if (raining == 1)                System.out.println("Wear boots, pants, raincoat, and gloves.");            } else {                //for any temperature beolow 30                System.out.println("Wear boots, pants, sweater, and gloves.");            }        } else { //this is where the error occurs             if (raining == 1) {                System.out.println("Wear long-sleeve shirt, pants, a raincoat, and shoes");            } else {                System.out.println("Wear long-sleeve shirt, pants, and shoes");            }        }    }
查看完整描述

1 回答

?
catspeake

TA貢獻(xiàn)1111條經(jīng)驗(yàn) 獲得超0個(gè)贊

本來應(yīng)該是這樣的:


/* Author: Collin Walsh

Date: 10/15/2019

File name: NstedIfs.java

*/


import java.util.Scanner;


public class NestedIfs {


    // main

    public static void main(String[] args) {


        Scanner keyboard = new Scanner(System.in);


        double outsideTempF;


        System.out.println("What is the temperature outside? Input a value and press enter ");


        outsideTempF = keyboard.nextDouble();


        Scanner input = new Scanner(System.in);


        int raining = 0;


        System.out.println("If it is raining, enter the number 1. Then press enter");


        raining = keyboard.nextInt();


        // indicate what clothing to wear, based on temp

        if (outsideTempF > 70) {

            if (raining == 1) {

                System.out.println("Wear t-shirt, shorts, sandals, and an unbrella");

            } else {

                System.out.println("Wear t-shirt, shorts, and sandals.");

            }

        } else if (outsideTempF <= 30) {

            if (raining == 1) {

                System.out.println("Wear boots, pants, raincoat, and gloves.");

            } else {

                // for any temperature beolow 30

                System.out.println("Wear boots, pants, sweater, and gloves.");

            }

        } else {

            if (raining == 1) {

                System.out.println("Wear long-sleeve shirt, pants, a raincoat, and shoes");

            } else {

                System.out.println("Wear long-sleeve shirt, pants, and shoes");


            }

        }

    }

}

其中一個(gè)牙套有問題,其中一個(gè)System.out.println缺少一個(gè)點(diǎn),所以它是System.outprintln


查看完整回答
反對(duì) 回復(fù) 2023-11-01
  • 1 回答
  • 0 關(guān)注
  • 212 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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