设变量已正确定义,选项()与以下程序段不等价。switch(choice){case1:price=3.0;case2:price=2.5;default:price=0.0;}A.price=0.0;B.switch(choice){default:price=0.0;case2:price=2.5;case1:price=3.0;}C.price=0.0;switch(choice){case1:price=3.0;case2:price=2.5;}D.if(choice==1){price=3.0;price=2.5;price=0.0;}elseif(choice==2){price=2.5;price=0.0;}else{price=0.0;}
举一反三
- 请写出与以下else-if语句等价的switch语句。 if(choice == 1) price = 3.0; else if(choice == 2) price = 2.5; else if(choice == 3) price = 4.0; else if(choice == 4) price = 3.5; else{ price = 0.0; } switch { case 1: price=3.0; break; case 2: price=2.5; break; case 3:price=4.0;break; case 4: price=3.5;break; price=0.0; break; }
- 以下代码的输出结果是()。publicclassTest{publicstaticvoidmain(String[]args){double[]price=newdouble[5];price[0]=98.10;price[1]=32.18;price[2]=77.75;System.out.print((int)price[0]+""+(int)price[1]+""+(int)price[2]+""+(int)price[3]+""+(int)price[4]);}}
- 为查询Products表中,价格Price在5-10元之间的产品信息,请补全以下SELECT语句 SELECT ProductID,ProductName,Price FROM products WHERE_________ AND_________ A: price>=5,price<=10 B: price>5,price<10 C: price<=5,price<=10 D: price>=5,price>=10
- A—cost price B—factory priceC—net price D—price free on boardE—purchase price F—sale priceG—wholesale price H—purchase priceI—fixed price J—guaranteed priceK—cash price L—market priceM—preferential price N—piece priceO—price control P—maximum priceQ—minimum price ()批发价()单位价格
- The price formed in the commodity exchange is( ) A: “Free market” price B: “Closed market” price C: International market price D: Semi-closed market price