CS2124 Homework5-Intro to Computer Science Solved

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

Rate this product

Write up the answers to questions 1 and 2 in a text document.  Submit a .swift file for question 3, and another for question 4 1) What is the difference between:           a) a type and an instance

  1. a function definition and a function call
  2. a struct and a class
  3. a parameter and an argument
  4. a property and a method
  • Think of a real-world object and its properties. Make up some actions or behaviors that the object might be able to perform. Write them in plain English.
  • Using a struct, create a new type for the real-world object you thought of for 2) with the properties and methods you thought of. Remember to mark each property with a let or var depending on whether or not it will be allowed to change. If you are not sure how to implement the body of one of the methods, describe what the method should do in a comment.

Use the stuct to make a new instance of your type.

Hint: If you made any properties with custom types, you can create placeholder types that have empty implementations. (See the TrainingShoe example)

  • Write your own Date type with the following properties / methods
Properties Methods
month asShortString() -> String
day asLongString() -> String
year dateAfter(days : Int) -> Date

It should have an initializer that takes month, day, and year as Integers.

Here is an example of how to use this class:

  • HW5-amsed4.zip