Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

School of Information Technology Atkinson Faculty of Liberal and Professional Studies York University AK/ ITEC 1620 Introduction to Object Oriented Programming– Object-Based Programming_ FINAL EXAMINATION _WithAnswers

Rating
-
Sold
-
Pages
12
Grade
A+
Uploaded on
18-04-2023
Written in
2022/2023

School of Information Technology Atkinson Faculty of Liberal and Professional Studies York University AK/ ITEC 1620 Introduction to Object Oriented Programming– Object-Based Programming_ FINAL EXAM INATION _WithAnswers PART A: FIND OUTPUT OF JAVA CODE FRAGMENTS [40 marks] 1. What is the output of the following Java code fragment? [5 marks] String s = "York University"; int i = 3; int j = 9; int p = Of("n"); int q = ring(++i, j++).indexOf("n"); Sln(p + " " + i); Sln(q + " " + j); PART B: PROGRAMMING QUESTION [60 marks] 1) [15 marks] 7AK/ITEC 1620 3.0A&B: Object-Based Programming Fall 2007 Using the Coin class with the API shown below design and implement the driver class FlipRace which creates two Coin objects , then continually flips them both to see which coin comes up Heads three flips in a row. Continue flipping the coins until one coin wins the race and also consider the possibility that both coins achieve the objective in the same time (that will be a tie). Print the results of each turn and at the end print the winner and the total number of flips that were required. Possible output: flip 1 Tails Tails flip 2 Tails Tails flip 3 Tails Tails flip 4 Tails Heads flip 5 Tails Heads flip 6 Heads Tails flip 7 Tails Heads flip 8 Heads Tails flip 9 Heads Heads flip 10 Tails Tails flip 11 Heads Heads flip 12 Heads Tails flip 13 Heads Tails First coin is the winner after 13 flips The API for Coin class is: public Coin() // default constructor public void flip() //Flips the coin by randomly choosing a face value. public boolean isHeads() //Returns true if the current face of the coin is heads public String toString() // Returns the current face of the coin as a string.

Show more Read less
Institution
School Of Information Technology Atkinson Faculty
Course
School of Information Technology Atkinson Faculty









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
School of Information Technology Atkinson Faculty
Course
School of Information Technology Atkinson Faculty

Document information

Uploaded on
April 18, 2023
Number of pages
12
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$10.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
AllAcademic Other
View profile
Follow You need to be logged in order to follow users or courses
Sold
67
Member since
6 year
Number of followers
39
Documents
548
Last sold
1 month ago
All the academic resources you need.

All the academic resources you need.

3.7

7 reviews

5
3
4
1
3
2
2
0
1
1

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions