Question: convert the code from JAVA to C public class Weekend { public static void main(String [] args) { Film Watch[] = new Film[4]; Watch[0] =

convert the code from JAVA to C

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 < Watch.length; i++) { int mins = Watch[i].getminutes(); if (i == 0) { Shortest = Longest = Watch[i]; shorttime = longtime = mins; } else { if (mins < shorttime) { shorttime=mins; Shortest = Watch[i]; } 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"); } }

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!