Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class Weekend { public static void main(String [] args) { Film Watch[] = new Film[4]; Watch[0] = new Film(Shrek,133); Watch[1] = new Film(Up,117); Watch[2]

image text in transcribedimage text in transcribed

public class Weekend {

public static void main(String [] args) {

Film Watch[] = new Film[4];

Watch[0] = new Film("Shrek",133); Watch[1] = new Film("Up",117); Watch[2] = new Film("Beauty & The Beast",93); Watch[3] = new Film("Enigma",114);

Film Longest = null;

Film Shortest = null;

int longtime = 0;

int shorttime = 0;

for (int i=0; i

}

else {

if (mins

}

if (mins > longtime) { longtime=mins; Longest = Watch[i];

}

}

}

System.out.println("Longest film is " + Longest.getcalled() + " at " + longtime + " minutes");

System.out.println("Shortest film is " + Shortest.getcalled() + " at " + shorttime + " minutes");

}

}

public class Film {

String Name;

int min;

public Film(String sn, int ch) {

Name = sn;

min = ch;

}

public int getminutes() {

return min;

}

public String getcalled() {

return Name;

}

}

ASSIGNMENT OBJECTIVES: 1. Leaming objectives - Be able to describe and evaluate different type of programming languages 2. Learning outcomes: CLO 1.02 - Select a programming language to solve problems in certain domain according to evaluation criteria CLO 3.01 Evaluate design choices in a functional programming language INSTRUCTIONS: Read the given program written in Java language below. Understand what the program performed. public class Weekend { public static void main(String [] args) { Film atch[] = new Film[4]; Watch[0] = new Film ("Shrek", 133); Watch[1] = new Film ("Up", 117); Watch [2] = new Film ("Beauty & The Beast", 93); Watch [3] = new Film("Enigma", 114); Film Longest = null; Film Shortest = null; int longtime = 0; int shorttime = 0; for (int i=0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions

Question

What are Electrophoresis?

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago