The document discusses implementing classes in Java to model space exploration missions. It describes creating Spacecraft, Astronaut and SpaceMission classes to represent key entities, their attributes and interactions. Methods are defined to add/remove astronauts from missions while ensuring valid capacities. The Main class demonstrates interactions between the classes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
6 views
Week01-Lab-Classes and Objects
The document discusses implementing classes in Java to model space exploration missions. It describes creating Spacecraft, Astronaut and SpaceMission classes to represent key entities, their attributes and interactions. Methods are defined to add/remove astronauts from missions while ensuring valid capacities. The Main class demonstrates interactions between the classes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4
MODULE 1
CLASSES AND OBJECTS
NASA has task to create a Space Exploration Mission Planner represents a
fascinating and instructive challenge. This project aims to simulate the complex operations involved in planning and executing space missions, albeit on a much-simplified scale. By focusing on the core components of space exploration—spacecraft, astronauts, and the missions themselves—this project provides a practical application of object-oriented programming (OOP) principles in Java, one of the most versatile and widely used programming languages in the world. Java's OOP capabilities make it an ideal choice for modeling real-world entities and their interactions. In this project, we will design and implement three primary classes: Spacecraft, Astronaut, and SpaceMission. Each class will encapsulate specific attributes and behaviors relevant to its real-world counterpart, such as the spacecraft's type and capacity, the astronaut's rank and specialization, and the mission's duration and crew composition. By adhering to Java's OOP principles, such as encapsulation, inheritance, and polymorphism, we can create a modular and scalable system that could, in theory, be expanded into a more complex simulation. The Spacecraft class will model various types of spacecraft, focusing on attributes like name, type (e.g., shuttle, satellite), speed, and capacity. The Astronaut class will represent individuals with specific roles and skills, necessary for the success of space missions. The SpaceMission class will tie these elements together, managing the logistics of space missions, including the assignment of spacecraft and crew. To demonstrate the interactions between these classes and the functionality of our system, we will also create a Main class. This class will serve as the entry point for the simulation, using arrays of objects to manage and manipulate multiple spacecraft, astronauts, and missions simultaneously. Through this approach, we aim to illustrate not only the technical aspects of Java programming but also the thought processes behind modeling complex systems in a simplified manner. Basic Questions a. Implement the Spacecraft Class: Create a Spacecraft class with attributes for name, type (e.g., shuttle, satellite, cargo, crewed), speed, and capacity. Include a constructor to initialize these attributes and methods to get and set their values. Create one method named "launch" to print the spacecraft name. b. Implement the Astronaut Class: Design an Astronaut class with attributes for name, rank (e.g., commander, pilot), and specialization (e.g., engineer, scientist). Provide a constructor for initializing these attributes and appropriate getter and setter methods. Create one method named "performEVA" to print the Astronaut's name. c. Implement the SpaceMission Class: Develop a SpaceMission class with attributes for mission name, duration (in days), assigned spacecraft, and crew (an array of Astronauts). Include methods to add or remove astronauts from the crew. Create one method to print the SpaceMission name and print all the signed all astronaut name. Intermediate Questions a. Array Management in SpaceMission: Write a method in the SpaceMission class to add an astronaut to the mission, ensuring there's no duplication of astronauts. Implement another method to remove an astronaut by name. b. Spacecraft Assignment: In the SpaceMission class, implement a method to assign a Spacecraft to the mission, ensuring that the spacecraft's capacity is not exceeded by the astronaut crew size.
Solution Manual for Data Structures and Abstractions with Java, 5th Edition Frank M. Carrano, Timothy M. Henry - Download Now For An Unlimited Reading Experience