java,wen tiProblem DescriptionA holiday resort has rooms for$200 per night,or if customers stay for 1 or more weeks theyare charged $1200 per week (7 days for theprice of 6).In addition if the customer is amember of an automobile club,they receive an
来源:学生作业帮助网 编辑:作业帮 时间:2024/12/01 04:32:22
java,wen tiProblem DescriptionA holiday resort has rooms for$200 per night,or if customers stay for 1 or more weeks theyare charged $1200 per week (7 days for theprice of 6).In addition if the customer is amember of an automobile club,they receive an
java,wen ti
Problem Description
A holiday resort has rooms for$200 per night,or if customers stay for 1 or more weeks they
are charged $1200 per week (7 days for theprice of 6).In addition if the customer is a
member of an automobile club,they receive an additional 5% off regardless of the duration
of the stay.Assume that customers stay 1 to 6days or 1 week,2 weeks,…
import java.util.*;
public class ColculateCost
{
public static void main(String[]args)
{
Scanner keyboard=new Scanner(System.in);
System.out.println("Number of Nights?");
int numberNights=keyboard.nextInt();
System.out.println("Member of Auto Club(Y=yes,N=No)?");
char memberAutoClub=keyboard.nextChar();
double cost=0.0;
if(numberNights
java,wen tiProblem DescriptionA holiday resort has rooms for$200 per night,or if customers stay for 1 or more weeks theyare charged $1200 per week (7 days for theprice of 6).In addition if the customer is amember of an automobile club,they receive an
import java.util.*;
public class ColculateCost
{
public static void main(String[]args)
{
Scanner keyboard=new Scanner(System.in);
System.out.println("Number of Nights?");
int numberNights=keyboard.nextInt();
System.out.println("Member of Auto Club(Y=yes,N=No)?");
String memberAutoClub=keyboard.next();
double cost=0.0;
if(numberNights<7)
{
cost=numberNights*200;
}
else
{
cost=numberNights/7*1200;
}
if("Y".equals(memberAutoClub))
{
cost=cost*0.95;
}
System.out.println("Cost=$"+cost);
}
}
好了.