I did this java program. In this exercise, you will be writing a simple java program to explore the decision making mechanism using if/else and switch statements.

The program is consists of one class (RentalCalculator). It will hold only one method, of course, in that case the name is main().
Write a Rental Amount Calculator Program for a Video Store. The rental amount will be calculated based on the following criteria:
a) The price of a regular DVD is $2.00. If rented on weekend, you have to pay another 25 cents extra per DVD.
The store also provides some discount based on the following:
b) If rented more than 5, there is a 20 cents discount per DVD.
c) If it is a special day (like Valentine’s day, Mother’s day...etc.,) , another 25 cents discount per DVD.
d) Discounts also given based on membership status. For VVIP, it is 15 cents. For VIP, it is 10 cents and for Regular member it is 5 cents per DVD.
e) Customer also has to pay 13% HST as usual.
Based on the above, determine the final rental amount and display the amount using two digits after the decimal point. The number of DVDs, weekend(y/n), special day(y/n) information, along with membership status (VVIP/VIP/REG) will be input from the keypad.

how do i stop the program if user doesn't enter 1 or 2 or 3
the java program that i did was:

private double movies;
private double weekend;
private double specialday;
private double membership;

public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Enter the number of movies: ");
int movies = input.nextInt();
System.out.print("Weekend? 1 for yes and 2 for no: ");
int weekend = input.nextInt();
System.out.print("Special day? 1 for yes, 2 for No: ");
int Specialday = input.nextInt();
System.out.print("What type of Membership (1 for VVIP, 2 for VIP, 3 for REG): ");
int membership = input.nextInt();

Exercises3 rental = new Exercises3(movies, weekend, Specialday, membership);
System.out.printf("Rental: %.3f", rental.rental());

}
public Exercises3(int movies, int weekend, int specialday, int membership) {
this.movies = movies;
this.weekend= weekend;
this.specialday = specialday;
this.membership = membership;
}

public double rental(){
double price=2;
double subtotal=0;
if (movies <= 5) {price -= 0.2;}
if (movies > 5) {price += 0;}
if (weekend == 1) {price += 0.25;}
if (weekend == 2) {price += 0;}
if (specialday == 1) {price -= 0.25;}
if (specialday == 2) {price += 0;}
if (membership == 1) {price -= 0.15;}
if (membership == 2) {price -= 0.10;}
if (membership == 3) {price -= 0.05;}

subtotal = price * movies;
return subtotal * 1.13;

}
}

get a face

do a System.exit() after getting the input, if membership is not from 1 to 3.

print an error message before exiting, so they'll know why.

what do i put in the parenthesis in System.exit()

To stop the program if the user doesn't enter 1 or 2 or 3, you can use a loop to continuously prompt the user for input until a valid option is entered. Here's an updated version of your code that includes this logic:

```java
import java.util.Scanner;

public class RentalCalculator {
private double movies;
private double weekend;
private double specialday;
private double membership;

public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Enter the number of movies: ");
int movies = input.nextInt();
System.out.print("Weekend? 1 for yes and 2 for no: ");
int weekend = input.nextInt();
System.out.print("Special day? 1 for yes, 2 for No: ");
int specialday = input.nextInt();

int membership;
while (true) {
System.out.print("What type of Membership (1 for VVIP, 2 for VIP, 3 for REG): ");
membership = input.nextInt();
if (membership == 1 || membership == 2 || membership == 3) {
break;
}
System.out.println("Invalid membership option. Please try again.");
}

RentalCalculator rental = new RentalCalculator(movies, weekend, specialday, membership);
System.out.printf("Rental: %.2f", rental.calculateRental());

}

public RentalCalculator(int movies, int weekend, int specialday, int membership) {
this.movies = movies;
this.weekend = weekend;
this.specialday = specialday;
this.membership = membership;
}

public double calculateRental() {
double price = 2;
if (movies > 5) {
price -= 0.2;
}
if (weekend == 1) {
price += 0.25;
}
if (specialday == 1) {
price -= 0.25;
}
if (membership == 1) {
price -= 0.15;
} else if (membership == 2) {
price -= 0.10;
} else if (membership == 3) {
price -= 0.05;
}

double subtotal = price * movies;
return subtotal * 1.13;
}
}
```

In this updated code, I've added a while loop that continues to prompt the user for the membership option until a valid input of 1, 2, or 3 is entered. If the user enters an invalid membership option, a message is displayed asking the user to try again. Once a valid membership option is entered, the loop is exited, and the rental calculation is performed as before.

geez - don't you read the java docs?

They are very complete.
or, just google java exit for examples.
I was pleasantly surprised when I learned java at the fine quality of the documentation. And a little google will find you code snippets illustrating almost any topic with real-life examples.