005-002-007
If-Else Statement: Membership Status
Easy
Problem Description
If-Else Statement: Membership Status
Learning Objective: Make binary choice with if-else statement
In this problem, you will create a program that reads an integer purchase count, uses an if-else statement to determine whether the customer qualifies as a member (10 or more purchases), and displays either "Member" or "Regular customer" to standard output.
Create a program that inputs a purchase count and displays "Member" for 10 or more purchases, or "Regular customer" for fewer than 10. Use an if-else statement to always display exactly one of the two results.
Input
Line 1: Purchase count (integer)
Output
For 10+:
Purchase count: [count] times
Member
For under 10:
Purchase count: [count] times
Regular customer
Test Cases
※ Output examples follow programming industry standards
Input:
15
Expected Output:
Purchase count: 15 times Member
Input:
5
Expected Output:
Purchase count: 5 times Regular customer
Input:
10
Expected Output:
Purchase count: 10 times Member
Input:
9
Expected Output:
Purchase count: 9 times Regular customer
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 10 free executions remaining
