Answer:
public class Main
{
public static void main(String[] args) {
System.out.println(starString(4));
}
public static String starString(int n){
double p = Math.pow(2,n);
String s = "";
for(int i=0; i<p; i++)
s += "*";
return s;
}
}
Explanation:
Create a method named starString that takes an integer parameter, n
Get the 2 to the nth power using pow method and set it to the p
Create an empty string that will hold the asterisks
Create a for loop that will iterate p times. Inside the loop, concatenate an asterisk to the s
Return the s
Inside the main method, call the method with an integer parameter
B I think it is but I am not 100% sure on
Answer:
Answered below
Explanation:
Scanner n = new Scanner(System.in);
System.out.print("Enter number of guests: ");
int numOfGuests = n.nextline();
double pricePerGuest = 35.0;
double totalAmount = numOfGuests * pricePerGuest;
String event = " ";
if ( numOfGuests >= 50){
event = "Large event";
}else{
event = "small event";
}
System.out.print(numOfGuests);
System.out.println(pricePerGuest);
System.out.println( totalAmount);
System.out.println(event);
Answer:
d are the values that can be stored in the c#"bool"data type