Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

107 MA ammeter 56 resistor ? V voltmeter

Answered: 1 week ago

Question

Generally If Drug A is an inducer of Drug B , Drug B levels will

Answered: 1 week ago

Question

=+applying to all or most employers and employees?

Answered: 1 week ago

Question

=+associated with political parties and if so, which ones? Are

Answered: 1 week ago