Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me change, I wrote a national tourism rate information system, pleas

ID: 3908794 • Letter: P

Question

Please help me change, I wrote a national tourism rate information system, please add when the input is 0 to stop the loop, then you can also improve other things, please add to me, thank you

import java.util.Scanner;

public class tourism {
  
      
   public static void main(String []args) {
          System.out.println("Welcome to our rating system!");
           Scanner location = new Scanner(System.in);
           System.out.println("Here are the countries you can rate in our system: ");
           String countrylist[] = new String[10]; {
               countrylist[0] = "1. China";
               countrylist[1] = "2. Japan";
               countrylist[2] = "3. Korea";
               countrylist[3] = "4. North Korea";
               countrylist[4] = "5. Australia";
               countrylist[5] = "6. Singapore";
               countrylist[6] = "7. Indonesia";
               countrylist[7] = "8. New Zealand";
               countrylist[8] = "9. India";
               countrylist[9] = "10. Maldives";
           };
           //for loop
       for(int i=0; i<10; i++) {
           System.out.println(countrylist[i]);
       }
       System.out.println("Please choose a country you want to rate: ");
           int area = location.nextInt();
           Scanner s = new Scanner(System.in);
           System.out.println("------------------------------");
           //while loop
           while(true) {
              
              
               if(area == 1) {
           System.out.println("What do you think about " + countrylist[area-1] + " (1 to 10): ");
               int a =0;
               System.out.println("Cleanliness: ");
               int cleaninessChina[] = new int[100];
               cleaninessChina[a] = s.nextInt();
               System.out.println("Citizen: ");
               int citizenChina[] = new int[100];
               citizenChina[a] = s.nextInt();
               System.out.println("Traffic" );
               int trafficChina[] = new int[100];
               trafficChina[a] = s.nextInt();
               System.out.println("Any other comments(enter 0 if you do not have comments): ");
               String commentsChina[] = new String[100];
               commentsChina[a] = s.next();
               a++;
               System.out.println("Thanks ");
               break;

Explanation / Answer

code will be like

import java.util.Scanner;

class Main {
  
  
public static void main(String[] args)
{
System.out.println("Welcome to our rating system!");
Scanner location = new Scanner(System.in);
System.out.println("Here are the countries you can rate in our system: ");
String countrylist[] = new String[10]; {
countrylist[0] = "1. China";
countrylist[1] = "2. Japan";
countrylist[2] = "3. Korea";
countrylist[3] = "4. North Korea";
countrylist[4] = "5. Australia";
countrylist[5] = "6. Singapore";
countrylist[6] = "7. Indonesia";
countrylist[7] = "8. New Zealand";
countrylist[8] = "9. India";
countrylist[9] = "10. Maldives";
};
//for loop
for(int i=0; i<10; i++)
{
System.out.println(countrylist[i]);
}
Boolean flag=true;
System.out.println("Please choose a country you want to rate: ");
int area = location.nextInt();
Scanner s = new Scanner(System.in);
System.out.println("------------------------------");
//while loop
while(flag==true)
{
if(area == 1)
{
System.out.println("What do you think about " + countrylist[area-1] + " (1 to 10): ");
int a =0;
System.out.println("Cleanliness: ");
int cleaninessChina[] = new int[100];
cleaninessChina[a] = s.nextInt();
System.out.println("Citizen: ");
int citizenChina[] = new int[100];
citizenChina[a] = s.nextInt();
System.out.println("Traffic" );
int trafficChina[] = new int[100];
trafficChina[a] = s.nextInt();
System.out.println("Any other comments(enter 0 if you do not have comments): ");
String commentsChina[] = new String[100];
commentsChina[a] = s.next();
a++;
System.out.println("Thanks ");
}
if(area==0)
{
flag=false;
}
  

}
System.out.println("I am at the end of while loop");
}

}

If the above solution is helpful to you in any way please rate it Or if you have any concerns please comment it, I will help you through

Note:I could not upload the image due to server issue, I will do it for you by tommorow of sure.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote