Question
Create an Eclipse project named Lab_Project_9, then import the CPS150_Lab9.java source code file. Do not create a Main class; instead: Download the CPS150_Lab9.java file into
Create an Eclipse project named Lab_Project_9, then import the CPS150_Lab9.java source code file. Do not create a Main class; instead:
Download the CPS150_Lab9.java file into the src sub-folder of your project folder. Remember that if you created the project in the default location, the project folder is located in the workspace folder of your home folder (e.g.: C:\Users\doej1\workspace\Lab_Project_9).
In Eclipse's Project explorer:
Expand your project folder to display the src sub-folder.
Right-click on the src sub-folder, and select the Refresh option.
Expand the src sub-folder, and then the default package sub-folder.
Open the file CPS150_Lab9.java.
Once the source file is opened:
Open the source code and:
Add your name to the comment block immediately above public class CPS150_Lab9 (indicated by *** Replace with your name ***)
Add the code as described by (and immediately below) each of the comment blocks labeled Lab 9.1 - 9.5.
/* * CPS150_Lab9.java */
/** * CPS 150, Spring 2018 semester * * Section *** replace with your section number (03 or 04) *** * * Lab Project 9: Java booleans and Boolean Logic * * @author *** Replace with your name *** */ public class CPS150_Lab9 { /** * Add the code as described by (and immediately below) each of * the comment blocks labeled Lab 9.1 - 9.5 in the main method, * as well as the method implementations below the line labeled * ADD BOOLEAN METHODS IMMEDIATELY BELOW THIS LINE. */ public static void main(String[] args) { /* Lab 9.1: Declare boolean variables for the following predicates: a. I am taking a Math course b. I am taking a History course c. I am taking an English course d. I am taking a Computer Science course For example, you could declare the last variable (d) as: boolean takingCSCourse; */ // ADD Lab 9.1 CODE HERE /* Lab 9.2: Initialize each of the boolean variables declared in Lab 9.1 above based on whether or not your are taking a course in each of those disciplines For example, you would initialize the last variable (9.1.d) as: takingCSCourse = true; */ // ADD Lab 9.2 CODE HERE /* Lab 9.3: Using only boolean operators, write boolean expressions, and output their results, for each of the following Boolean expressions on the variables declared in Lab 9.1 and initialized in lab 9.2: a. I am not taking a Math course b. I am taking a History course c. I am not taking an English course d. I am taking a Computer Science course For example, you could output expression (a) as: System.out.println("I am not taking a Math course is " + !takingMathCourse); */ // ADD Lab 9.3 CODE HERE /* Lab 9.4: Using only boolean operators, write boolean expressions, and output the results, for each of the following Boolean expressions on the variables declared in Lab 9.1 and initialized in lab 9.2: a. I am neither taking a Math nor a Computer Science course (i.e., I am not taking a Math course and I am not taking a Computer Science course) b. I am taking a History course and I am taking an English course c. I am taking a Math course or I am taking an English course d. I am taking a History course or I am taking a Computer Science course For example, you could output the last expression (d) as: System.out.println("Taking History or English is " + (takingHistoryCourse || takingEnglishCourse)); */ // ADD Lab 9.4 CODE HERE /* Lab 9.5: 1. Write a boolean method implementation (i.e., a method that has a boolean result) for each of the following Boolean expressions: a. I am taking a Computer Science Course or I am not taking a Computer Science course b. I am either taking a Math course or I am taking an English course and I am taking a History course c. I am either taking a Computer Science course or I am taking a Math course and I am taking an English course or I am taking a History course (Write the method definitions following the line below labeled "ADD BOOLEAN METHODS IMMEDIATELY BELOW THIS LINE") 2. In this main method, add a call to each of the methods defined in part 9.5.1, and output its result For example, you would output the result of calling the first method (a) as: System.out.println("Taking Computer Science or not is " + CSOrNotCS(takingCSCourse)); */ // ADD Lab 9.5 CODE HERE } // end main method /* ADD BOOLEAN METHODS IMMEDIATELY BELOW THIS LINE */ /* * CSOrNotCS(boolean) -> boolean * * method is given a boolean value for whether I am taking a Computer Science course * method returns the boolean value of "CS or not CS" * * ADD METHOD IMPLEMENTATION BELOW THE FOLLOWING LINE */ /* * MathOrEnglishAndHistory(boolean, boolean, boolean) -> boolean * * method is given a boolean values for whether or not: * 1. I am taking a Math course * 2. I am taking an English course * 3. I am taking a History course * method returns the boolean value of "Math or English and History" * * ADD METHOD IMPLEMENTATION BELOW THE FOLLOWING LINE */ /* * CSOrMathAndEnglishOrHistory(boolean, boolean, boolean, boolean) -> boolean * * method is given a boolean values for whether or not: * 1. I am taking a Computer Science course * 1. I am taking a Math course * 2. I am taking an English course * 3. I am taking a History course * method returns the boolean value of "CS or Math and English or History" * * ADD METHOD IMPLEMENTATION BELOW THE FOLLOWING LINE */ } // end class CPS150_Lab9
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started