Now enrolling K-12 students for the 2021-22 school year | Ahora inscribiendo estudiantes de kínder a doceavo grado para el año escolar 2021-22 Enroll now | Inscríbase ahora

CB 40 AP Computer Science A (Java)

Difficulty: High, 2 Semesters — 1 Practical Arts/Elective Credit

Prerequisite: CB 36

This course provides an introduction to college level programming, using the JAVA language. Important concepts include: structured JAVA programming style, assignment and logical operators, decision making, looping, functions, and arrays. Students will also learn the concepts of data structures, classes, inheritance, recursion, and other advanced topics using an object oriented approach. These techniques represent proven approaches for developing solutions that can scale up from small, simple problems to large, complex problems. Students may seek college credit by taking the Advanced Placement (AP) examination in May.

NOTE: This is a weighted course.

Assignment 2 Control Tower

The Airplane class (already developed) has the following constructors and methods:


Airplane() Creates an Airplane with call sign “AAA01” located on the landing strip: 1 mile due north (0°) of the tower at an altitude of 0 feet.
Airplane(String cs, double dist, int dir, int alt)

Creates an Airplane with call-sign cs dist miles from the tower on a bearing of dir degrees, at an altitude of alt feet.

Notes: alt and dist will always be read as absolute values (non-negative). If dir is not between 0 and 360, the bearing will be set to dir % 360.



move(double dist, int dir) Void method. Changes the Airplane position by dist miles on a heading of dir degrees.
gainAlt() Void method. Increases the altitude of the Airplane by 1000 feet.
loseAlt() Void method. Decreases the altitude of the Airplane by 1000 feet, or to 0 if altitude is less than 1000 feet.
getAlt() Returns an int representing the altitude of the Airplane.
toString() Returns a String representation of the Airplane including all fields. For example: AAL123 - 110.5 miles away at bearing 059°, altitude 4500 feet
distTo(Airplane other) Returns a double representing the distance in miles between this Airplane and the Airplane other