-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomerAnalysis.java
More file actions
45 lines (44 loc) · 1.21 KB
/
Copy pathcustomerAnalysis.java
File metadata and controls
45 lines (44 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.util.*;
public class customerAnalysis
{
int tot_rating=0, p;
String[] cus_name = new String[10];
int[] cus_rating = new int[10];
Scanner customer = new Scanner(System.in);
public void scan()
{
for(int i=0,s=1;i<10;i++,s++)
{
System.out.println("\nEnter the customer name " +s);
cus_name[i] = customer.next();
System.out.println("\nEnter the rating from 1 to 5, Ms./Mr. " +cus_name[i]);
cus_rating[i] = customer.nextInt();
if(cus_rating[i]>5)
cus_rating[i] = 5;
if(cus_rating[i]<1)
cus_rating[i] = 1;
}
}
public void display()
{
for(int i=0;i<10;i++)
{
System.out.println("\nCustomer Ms./Mr. "+cus_name[i] +" gives rating "+ cus_rating[i]);
tot_rating = tot_rating+cus_rating[i];
}
}
public void calculate()
{
p = tot_rating/10; //Percentage
System.out.println("\nTotal Customer :10");
System.out.println("\nRating obtained by Andriod One Mobile is "+p);
}
public static void main(String[] args)
{
System.out.println("\tAndriod One Mobile\n");
customerAnalysis g = new customerAnalysis();
g.scan();
g.display();
g.calculate();
}
}