Search the whole station

数据结构代考 java考试助攻 数据结构考试代考 Java代考

Quiz Instructions

数据结构代考 About this midterm This is a four question exam; each question is worth 25 points and each question has at most two parts which vary in points.

Supporting Documents

The following is the only supporting API document for your references during the test

About this midterm

This is a four question exam; each question is worth 25 points and each question has at most two parts which vary in points. For each question, you will be asked to write some code and you will be asked to write an explanation as a response.

Each question will have a single text field where you will write your part A and part B responses. Since there is only one text response field, it is important to have labels for each part written.

i.e.

Part A) blah blah

Part B) blah blah

The rules during the test:

  1. This is not an open book test
  2. This is not an open internet test
  3. All work must be your own work
  4. No compilers or IDEs
  5. No copying and pasting from an editor and into the text response field.
  6. No images/snapshots pictures of your work.
  7. No phone look ups
  8. No open communication channels using discord and the like
  9. All video cameras must be turned on and must be showing you
  10. In other words be honest with your work.
  11. Ensure that you understand your code and explanations.
  12. Anyone that is caught cheating on during or on the exam will receive a total amount of 0 points for the midterm. Per university policy,  any  kind of cheating will be reported to the appropriate university reporting department for followup. 

Question 1 数据结构代考

This is a two part question. Write your response for both parts in the text field below. Make sure to indicate in your response about which response is part A and part B.

Part A) Blue whales and finback whales are huge. Beluga whales are small. Below are 3 classes that model these kinds of whales. Your job is to rewrite these classes using inheritance. Basically, at the end of rewriting these classes, you should end up having 4 classes: these 3, and a superclass. Rewrite these classes so that it meets this ending requirement. Examine the three classes below and think about how you will rewrite it so that your resulting response is 4 classes as mentioned earlier. (15 points)

class BlueWhale {
    private int weight;
    public BlueWhale(int weight) { this.weight = weight; }
    public boolean isHuge() { return true; }
}

class FinbackWhale {
    private int weight;
    public FinbackWhale(int weight) { this.weight = weight; }
    public boolean isHuge () { return true; }
}

class BelugaWhale {
    private int weight;
    public BelugaWhale(int weight) { this.weight = weight; }
    public boolean isHuge () { return false; }
}

Part B) What does the main method of Duck print? Please provide an explanation (do not show code). Zero points for not writing an explanation. (10 points)

class Bird {
     void speak() {
         System.out.println(“chirp”);
     }
}

class Duck extends Bird {
     void speak() {
         System.out.println(“quack”);
     }
     public static void main(String[] args) {
          Bird b = new Duck();
          b.speak();
     }
}

Question 2 数据结构代考

This is a two part question. Write your response for both parts in the text field below. Make sure to indicate in your response about which response is part A and part B.

Part A) You are given a task to create a class object that keeps track of Pokemon characters. (15 points)

The Pokemon character class is defined as

class PokemonCharacter {
   // You don’t need to know much about the details for this class
   // It just has a bunch of methods for the character
   String printName() { ... } // prints the characters name
}

Now the class you will create is called “MyPokemonCharacters”.

It will have the following methods:

  1. A class member that is an ArrayList type of PokemonCharacters
  2. One constructor with no arguments that initializes the ArrayList variable in #1.
  3. One method called AddCharacter which has one input parameter which is a PokemonCharacter type. This method returns a void type. This method adds the input character object into the ArrayList object that you created for #1
  4. One method called printCharacters with no input parameters. This method returns a void data type. This method just prints the name of all the Pokemon objects in the ArrayList member. 

In summary, you just need to create this class and that is it. So just show your code. Do not write a main method that tries to demonstrate this class. Just write the class.

Part B) (10 points) 

With the above class that you just created, explain what you would modify in your class code when you are now asked to modify your MyPokemonCharacters class to inherit from the ArrayList.

I want an explanation for your answer. I do not want to see any code. 0 points for not writing an explanation. You must write your explanation in this format:

  1. I will do this
  2. I will do that
  3. I will do etc..

Question 3 数据结构代考

This is a one part question only. Write your response for this part in the text field below. Make sure to indicate in your response about which response is part A.

Part A) (25 points) You are given a file that describes countries. Its first few lines look like this:

France

Paris

China

Beijing

Italy

Rome

Every country is represented by 2 lines. The first is the name and the second is the capital city.

You are also given the following class:

public class Country {
    private String name;
    private String capital;

    public Country(String name, String capital) {
         this.name = name;
         this.capital = capital;
    }
}

You task is to write a Java class called CountryReader that has one method. The method should have one argument: a File representing the countries file described above. The method should return an ArrayList<Country>, which contains all the countries in the file.

Question 4 数据结构代考

This is a two part question. Write your response for both parts in the text field below. Make sure to indicate in your response about which response is part A and part B.

Part A) (10 points) One of the following classes doesn’t compile. Which one? Why not?

class Star {
   private String name;
   Star(String s) { name = s; }
}
class WhiteDwarf extends Star { }

Part B) (15 points) Given the following class definition, what does the main method print? Explain why. 0 points for not writing an explanation. Your explanations should be short and concise. Do write a book or one page. I want a quick answer explanation.

class Robot {
  private float     mass;
  Robot(float m) { mass = m; }
  public static void main(String[] args) {
     Robot r1 = new Robot(100);
     Robot r2 = new Robot(100);
     if (r1.equals(r2))
        System.out.println(“deeply same”);
     else
        System.out.println(“deeply different”);
  }

View keyboard shortcuts

EditViewInsertFormatToolsTable

12pt

Paragraph

数据结构代考
数据结构代考

更多代写:Cs美国代写被抓  在家考托福作弊  英国final网课代修  cause and effect essay写作技巧  swot分析法特点  半群理论代考

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

The prev: The next:

Related recommendations

1
您有新消息,点击联系!