GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

[6 points] UML, Inheritance & Encapsulation The UML diagram…

[6 points] UML, Inheritance & Encapsulation The UML diagram specifies a small class hierarchy for a game. A student’s implementation follows. The code does not match the diagram in three places. For each, name the member and briefly state what’s wrong. ┌────────────────────────────────┐ │         GameCharacter                                                    │ ├────────────────────────────────┤ │ # health: int                                                                 │ │ # name: String                                                             │ ├────────────────────────────────┤ │ + GameCharacter(String, int)                                       │ │ + attack(): void                                                             │ │ + getName(): String                                                     │ └────────────────────────────────┘                  ▲                  │         ┌────────────────┐         │     Warrior                          │         ├────────────────┤         │ – armor: int                        │         ├────────────────┤         │ + Warrior(String, int, int)  │         │ + attack(): void                 │         └────────────────┘ public class GameCharacter {     private int health;     public String name;     public GameCharacter(String name, int health) {         this.name = name;         this.health = health;     }     public void attack() {         System.out.println(name + ” attacks!”);     }     public String getName() {         return name;     } } public class Warrior extends GameCharacter {     private int armor;     public Warrior(String name, int health, int armor) {         this.name = name;         this.health = health;         this.armor = armor;     } } Hint : Compare access specifiers and function implementations in both.

Read Details

[2 pts] Write any two differences between Java and Python (…

[2 pts] Write any two differences between Java and Python ( excluding syntax ) 

Read Details

[2 pts] What is overloading and overriding? 

[2 pts] What is overloading and overriding? 

Read Details

[2 pt] What is the purpose of the super keyword?

[2 pt] What is the purpose of the super keyword?

Read Details

[2 pt] What does the keyword final mean when applied to a va…

[2 pt] What does the keyword final mean when applied to a variable?

Read Details

[1pt]  All methods of an abstract class must be declared as…

[1pt]  All methods of an abstract class must be declared as abstract methods. (True or False?)

Read Details

[12 points] Generics  A bubble tea shop serves customers fir…

[12 points] Generics  A bubble tea shop serves customers first-come, first-served. Write a generic class BobaLine that models a fixed-capacity order line (a FIFO queue) using an ArrayList for the underlying representation. An enqueue is a customer joining the line; a dequeue is the barista serving the next order.  Implement: The constructor, which takes the capacity as an argument. enqueue — adds the passed-in argument to the tail of the line if there is room; otherwise prints “Order line is full. Cannot add new order.” dequeue — if the line is not empty, removes the element at the head of the line and returns it; otherwise prints “Order line is empty. Cannot serve an order.” and returns null. isEmpty — returns true if the line is empty and false otherwise. As a reminder, the ArrayList class provides the following methods that you are can also use. add(E elem) — appends elem to the current end of the list remove(int index) — removes the element at the specified position and returns it size() — returns the number of elements in the list isEmpty() — returns true if the list is empty and false otherwise

Read Details

Statements that explain how the speaker feels without passin…

Statements that explain how the speaker feels without passing judgment on the receiver are called I-STATEMENTS.

Read Details

Reminder:    Have you done Start Here Bonus A?           Yes…

Reminder:    Have you done Start Here Bonus A?           Yes or no   ___________ Bonus A is Due:  Sat. Aug. 22   for 5 bonus points   or   if received by Wed. Aug. 26 for 2.5 bonus points

Read Details

Sending messages through facial expressions, body language,…

Sending messages through facial expressions, body language, gestures, tone, and volume of voice is NONVERBAL COMMUNICATION.

Read Details

Posts pagination

Newer posts 1 … 48 49 50 51 52 … 93,410 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top