Question
(4) Modify the code blew fllowing the introduction and prove the full code. public class Arrays { public Arrays() { } public static void main(String[]
(4) Modify the code blew fllowing the introduction and prove the full 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 <= 1 ; i++ ) { for ( j = 0 ; j < 1 ; 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 <= 1 ; i++ ) System.out.println(t[i] + "\t$" + b[i]); System.out.println(" "); System.out.println("Cinema Complex Revenue "); for ( i = 0 ; i <= 1 ; i++ ) { for ( j = 0 ; j < 1 ; j++ ) System.out.println(s[i] + "\t$" + (a[i][j] * b[j] + a[i][j + 1] * b[j + 1])); } } }
Output
|
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.
|
|
Adults
|
Children
|
|
Cinema 1
|
|
029 |
149 |
|
Cinema 2
|
|
059 |
043 |
|
Cinema 3
|
|
147 |
011 |
|
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.
Output
Also,
Provide comments statements for each line of the Java Code shown below (i.e., give the lines purpose).
public class CharacterInfo
{
public static void main(String[] args)
{
char aChar = '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");
}
}
finally please Create a flow chart for the above code.
Thank you very much
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started