Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Surf Shack Code
#1
The code will create a random fate of the company SURF-SHACK INC. for a week
[code2=java]//By Zach Manson
package company;

import java.util.Random;


public class SurfShack {

public static void main(String[] args)
{
double rent = 0;
Random rnd = new Random();
int sBoard[] = new int[4];
sBoard[0] = 15;
sBoard[1] = 20;
sBoard[2] = 25;
sBoard[3] = 30;
int towel[] = new int[4];
towel[0] = 4;
towel[1] = 7;
towel[2] = 9;
towel[3] = 20;

int wetsuite[] = new int[8];
wetsuite[0] = 45;
wetsuite[1] = 70;
wetsuite[2] = 100;
wetsuite[3] = 120;
wetsuite[4] = 150;
wetsuite[5] = 175;
wetsuite[6] = 200;
wetsuite[7] = 250;
double gst[] = new double[16];
gst[0] = sBoard[0] / 10;
gst[1] = sBoard[1] / 10;
gst[2] = sBoard[2] / 10;
gst[3] = sBoard[3] / 10;
gst[4] = towel[0] / 10;
gst[5] = towel[1] / 10;
gst[6] = towel[2] / 10;
gst[7] = towel[3] / 10;
gst[8] = wetsuite[0] / 10;
gst[9] = wetsuite[1] / 10;
gst[10] = wetsuite[2] / 10;
gst[11] = wetsuite[3] / 10;
gst[12] = wetsuite[4] / 10;
gst[13] = wetsuite[5] / 10;
gst[14] = wetsuite[6] / 10;
gst[15] = wetsuite[7] / 10;
double company = 0;
int employeesPay = 70;

int week = 0;
System.out.println("STATICSTICS OF SURF-SHACK INC. OVER THE PAST WEEK");
System.out.println(" ");
System.out.println("=============================================================");
while (week < 7)
{
switch(week){

case 0:
System.out.println("Monday");
System.out.println("---------------------------------------------------");
break;

case 1:
System.out.println("Tuesday");
System.out.println("---------------------------------------------------");
break;

case 2:
System.out.println("Wednesday");
System.out.println("---------------------------------------------------");
break;

case 3:
System.out.println("Thursday");
System.out.println("---------------------------------------------------");
break;

case 4:
System.out.println("Friday");
System.out.println("---------------------------------------------------");
break;

case 5:
System.out.println("Saturday");
System.out.println("---------------------------------------------------");
break;

case 6:
System.out.println("Sunday");
System.out.println("---------------------------------------------------");
break;


}
int customers = rnd.nextInt(50);
week++;


switch (rnd.nextInt(16)){

case 0:
rent = (customers * sBoard[0]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * sBoard[0]);
System.out.println("Today the SurfShack made $" + customers * sBoard[0]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[0] * customers);
break;

case 1:
rent = (customers * sBoard[1]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * sBoard[1]);
System.out.println("Today the SurfShack made $" + customers * sBoard[1]);
System.out.println("---------------------------------------------------");
System.out.println("The Goods and Services Tax that was paid was $" + gst[1] * customers);
break;

case 2:
rent = (customers * sBoard[2]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * sBoard[2]);
System.out.println("Today the SurfShack made $" + customers * sBoard[2]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[2] * customers);
break;

case 3:
rent = (customers * sBoard[3]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * sBoard[3]);
System.out.println("Today the SurfShack made $" + customers * sBoard[3]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[3] * customers);
break;

case 4:
rent = (customers * towel[0]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * towel[0]);
System.out.println("Today the SurfShack made $" + customers * towel[0]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[4] * customers);
break;

case 5:
rent = (customers * towel[1]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * towel[1]);
System.out.println("Today the SurfShack made $" + customers * towel[1]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[5] * customers);
break;

case 6:
rent = (customers * towel[2]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * towel[2]);
System.out.println("Today the SurfShack made $" + customers * towel[2]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[6] * customers);
break;

case 7:
rent = (customers * towel[3]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * towel[3]);
System.out.println("Today the SurfShack made $" + customers * towel[3]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[7] * customers);
break;

case 8:
rent = (customers * wetsuite[0]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * wetsuite[0]);
System.out.println("Today the SurfShack made $" + customers * wetsuite[0]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[8] * customers);
break;

case 9:
rent = (customers * wetsuite[1]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * wetsuite[1]);
System.out.println("Today the SurfShack made $" + customers * wetsuite[1]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[9] * customers);
break;

case 10:
rent = (customers * wetsuite[2]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * wetsuite[2]);
System.out.println("Today the SurfShack made $" + customers * wetsuite[2]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[10] * customers);
break;

case 11:
rent = (customers * wetsuite[3]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * wetsuite[3]);
System.out.println("Today the SurfShack made $" + customers * wetsuite[3]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[11] * customers);
break;

case 12:
rent = (customers * wetsuite[4]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * wetsuite[4]);
System.out.println("Today the SurfShack made $" + customers * wetsuite[4]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[12] * customers);
break;

case 13:
rent = (customers * wetsuite[5]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * wetsuite[5]);
System.out.println("Today the SurfShack made $" + customers * wetsuite[5]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[13] * customers);
break;

case 14:
rent = (customers * wetsuite[6]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * wetsuite[6]);
System.out.println("Today the SurfShack made $" + customers * wetsuite[6]);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[14] * customers);
break;

case 15:
rent = (customers * wetsuite[7]) / 10;
company = company - ((employeesPay * 5) + rent) + (customers * wetsuite[7]);
System.out.println("Today the SurfShack made $" + wetsuite[7] * customers);
System.out.println("---------------------------------------------------");
System.out.println("The total Goods and Services Tax that was paid was $" + gst[15]);
break;
}
System.out.println("---------------------------------------------------");
System.out.println("SurfShack inc. is now worth $" + company);
System.out.println("---------------------------------------------------");
System.out.println("The rent was $" + rent);
System.out.println("--------------------------------------------------");
System.out.println("There was " + customers + " customers");
System.out.println("_____________________________________________________________");

}

}

}[/code2]


Forum Jump:


Users browsing this thread: 1 Guest(s)