Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 package com.ng interface MCall { default int f10 { return 2: } } Q1: Does this program have type errors? Explain static and dynamic
2 package com.ng interface MCall { default int f10 { return 2: } } Q1: Does this program have type errors? Explain static and dynamic type (subtype and supertype) assignments for variables with references to the JLS, statement by statement for the lines of code labeled with comments that start with //statement. Which statements, if any, public class hain implements call it should you comment out to make this program compile and run without producing any errors? With commented out statement(s), what output does the program print? Why? Please explain. fvar = 7; } Total: 9 points ; 8 9 10 11 12 13 14 15 static { static int fvar = 0; public int fvari = 2_0; public int fO{ return fvar = 1; 1; } interface MCall { default int tot return 2; } } public class Nested extends Main implements Main.MCall { int fvar = 1; Q2: In your own words please explain what significant drawbacks Prof. Kernighan identified in the design of the programming language Pascal. (4 points) 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 public int f() { fvar - Main.this.fvari; return fvar: } } public static void main(String[] args) { Main.MCall calli = new Main() new Nested(); Main call2 = new Main(). new Nested(); Main. Nested call3 - (Main. Nested) new Main(); com.mg.MCall call4 = new Main(); System.out.println(calli.f(); System.out.println(call2.f(); System.out.println(call3.0); System.out.println(call4.10); } 31 32 Q3: Please create a Scala program that contains a List of tables where each element of this list is a table object whose key is a variable of type String that maps to a value that is a table object whose key is a variable of type String that maps to an integer value. Next, add the command line input where a user of your program is asked in a loop to enter the name of a scope and then for this scope to enter the names of variables and their values. Save the entered values in the List of tables. The loop is terminated by entering the string "quit" without quotes. The program must be built using the Sbt (7 points). //statement 1 //statement 2 //statement 3 //statement 4 //statement 5 //statement 6 //statement 7 //statement 8 33 35 37 38 39 2 package com.ng interface MCall { default int f10 { return 2: } } Q1: Does this program have type errors? Explain static and dynamic type (subtype and supertype) assignments for variables with references to the JLS, statement by statement for the lines of code labeled with comments that start with //statement. Which statements, if any, public class hain implements call it should you comment out to make this program compile and run without producing any errors? With commented out statement(s), what output does the program print? Why? Please explain. fvar = 7; } Total: 9 points ; 8 9 10 11 12 13 14 15 static { static int fvar = 0; public int fvari = 2_0; public int fO{ return fvar = 1; 1; } interface MCall { default int tot return 2; } } public class Nested extends Main implements Main.MCall { int fvar = 1; Q2: In your own words please explain what significant drawbacks Prof. Kernighan identified in the design of the programming language Pascal. (4 points) 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 public int f() { fvar - Main.this.fvari; return fvar: } } public static void main(String[] args) { Main.MCall calli = new Main() new Nested(); Main call2 = new Main(). new Nested(); Main. Nested call3 - (Main. Nested) new Main(); com.mg.MCall call4 = new Main(); System.out.println(calli.f(); System.out.println(call2.f(); System.out.println(call3.0); System.out.println(call4.10); } 31 32 Q3: Please create a Scala program that contains a List of tables where each element of this list is a table object whose key is a variable of type String that maps to a value that is a table object whose key is a variable of type String that maps to an integer value. Next, add the command line input where a user of your program is asked in a loop to enter the name of a scope and then for this scope to enter the names of variables and their values. Save the entered values in the List of tables. The loop is terminated by entering the string "quit" without quotes. The program must be built using the Sbt (7 points). //statement 1 //statement 2 //statement 3 //statement 4 //statement 5 //statement 6 //statement 7 //statement 8 33 35 37 38 39
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