Question: Modify the following code: public class Arrays { public Arrays() { } public static void main(String[] args) { float [][] a = new float [][]

Modify the following code:

public class Arrays {

public Arrays() {

}

public static void main(String[] args) {

float[][] a = new float[][] {{500, 200}, {100, 400}};

float[] b = new float[] {8, 6};

String[] s = new String[] {"cinema 1", "cinema 2"};

String[] t = new String[] {"Adults", "Children"};

int i,j;

System.out.println(" ");

System.out.println("Cinema Complex Attendance");

System.out.println(" ");

System.out.println(" \t\tAdults\t\t" + "Children");

System.out.println("\t\t_ _ _ _ _ _\t" + "_ _ _ _ _ _ ");

for ( i = 0 ; i

{

for ( j = 0 ; j

System.out.println(s[i] + " \t" + a[i][j] + "\t\t" + a[i][j + 1]);

}

System.out.println(" Cinema Complex Admission ");

for ( i = 0 ; i

System.out.println(t[i] + "\t$" + b[i]);

System.out.println(" ");

System.out.println("Cinema Complex Revenue ");

for ( i = 0 ; i

{

for ( j = 0 ; j

System.out.println(s[i] + "\t$" +

(a[i][j] * b[j] + a[i][j + 1] * b[j + 1]));

}

}

}

A movie complex has three separate theaters: Cinema 1, Cinema 2 and Cinema 3. The attendance Monday for the entire complex is given in the matrix below.

Modify the following code: public class Arrays { public Arrays() { }

If the admission price for each cinema is $4 for children and $8 for adults, find the total revenue that was collected Monday at the theater complex. Hint: multiply the above matrix A, which contains the total tickets sold, by column matrix B,containing the admission prices, and then compute the matrix product A B.

(5a) Provide comments statements for each line of the Java Code shown below (i.e., give the lines purpose). [Note: you have seen this code in Week 5]

public class CharacterInfo

{

public static void main(String[] args)

{

charaChar = 'C';

System.out.println("The character is " +aChar);

if(Character.isUpperCase(aChar))

System.out.println(aChar + " is uppercase");

else

System.out.println(aChar + " is not uppercase");

if(Character.isLowerCase(aChar))

System.out.println(aChar + " is lowercase");

else

System.out.println(aChar + " is not lowercase");

aChar=Character.toLowerCase(aChar);

System.out.println("After toLowerCase(), aChar is " + aChar);

aChar=Character.toUpperCase(aChar);

System.out.println("After toUpperCase(), aChar is " + aChar);

if(Character.isLetterOrDigit(aChar))

System.out.println(aChar + " is a letter or digit");

else

System.out.println(aChar + " is neither a letter nor a digit");

if(Character.isWhitespace(aChar))

System.out.println(aChar + " is whitespace");

else

System.out.println(aChar + " is notwhitespace");

}

}

(6) Create a flow chart for the above code from Exercise 5a.

Cinema 1 Cinema 2 Cinema 3 Adults 29 59 147 Children 149 11

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!