- javacity
- Tuesday, October 14th, 2008 at 5:34:31pm MDT
- import java.util.Scanner;
- public class JavaCity
- {
- private String JavaCity;
- JavaCity = Name ;}
- return JavaCity;}
- public void displayMessage(){
- }
- private int Round=1;
- private int Population=0;
- private int Culture=0;
- private int Food=0;
- private int Productivity=0;
- private int Wealth=0;
- private int choice;
- public void printStat(){
- do {
- System.out.printf("Round %d,[Population: %d,Culture: %d,Food: %d,Productivity: %d,Wealth: %d]\n",Round,Population,Culture,Food,Productivity,Wealth);
- System.out.printf("Please select:\n1.Add Professional\n2.Add Farmer\n3.Add Worker\n4.Add Businessman\n5.Leave the city");
- Round += 1;
- choice = gh.nextInt();//public void askForInput()
- if (choice == 1){
- Population += 1000;
- Culture += 1;
- Food -= 1;
- Productivity -= 1;
- System.out.print("Message: adding 1000 Professional to the city!\n");//public void addProfessional()
- }
- else if (choice == 2){
- Population += 1000;
- Food += 1;
- }// public void addFarmer()
- else if (choice == 3){
- Population += 1000;
- Food -= 1;
- Productivity += 1;
- }//public void addWorker()
- else if (choice == 4){
- Population += 1000;
- Food -= 2;
- Productivity += 1;
- Wealth += 1;
- }
- else if (choice == 5){
- else if(choice >= 6){
- }while((choice != 5 )&&(choice <=5));
- }
- JavaCity nj = new JavaCity();
- nj.displayMessage();
- nj.printStat();
- }
- }
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.