(New Full Course Guide)CMIS 242 Entire Course Study Solutions Download
CMIS 242 Entire Course Study Solutions Download
CMIS 242 Entire Course includes:
CMIS242 Project 1 Minimum Maximum and Average,
CMIS242 Project 2 Computes the Sales Tax,
CMIS242 Project 3 Draws Two Types of Shapes,
CMIS242 Project 4 Manage a Real Estate Database
CMIS 242 Project Media Rental System
Design and implement Java program as follows:
1) Media hierarchy:
Create Media, EBook, MovieDVD, and MusicCD classes from Week 3 -> Practice Exercise – Inheritance solution.
Add an attribute to Media class to store indication when media object is rented versus available. Add code to constructor and create get and set methods as appropriate.
Add any additional constructors and methods needed to support the below functionality
2) Design and implement Manager class which (Hint: check out Week 8 Reading and Writing files example):
stores a list of Media objects
has functionality to load Media objects from files
creates/updates Media files
has functionality to add new Media object to its Media list
has functionality to find all media objects for a specific title and returns that list
has functionality to rent Media based on id (updates rental status on media, updates file, returns rental fee)
3) Design and implement MediaRentalSystem which has the following functionality:
user interface which is either menu driven through console commands or GUI buttons or menus. Look at the bottom of this project file for sample look and feel. (Hint: for command-driven menu check out Week 2: Practice Exercise – EncapsulationPlus and for GUI check out Week 8: Files in GUI example)
selection to load Media files from a given directory (user supplies directory)
selection to find a media object for a specific title value (user supplies title and should display to user the media information once it finds it – should find all media with that title)
selection to rent a media object based on its id value (user supplies id and should display rental fee value to the user)
selection to exit program
4) Program should throw and catch Java built-in and user-defined exceptions as appropriate
5) Your classes must be coded with correct encapsulation: private/protected attributes, get methods, and set methods and value validation
6) There should be appropriate polymorphism: overloading, overriding methods, and dynamic binding
7) Program should take advantage of the inheritance properties as appropriateStyle and Documentation:
Make sure your Java program is using the recommended style such as:
Javadoc comment up front with your name as author, date, and brief purpose of the program
Comments for variables and blocks of code to describe major functionality
Meaningful variable names and prompts
Class names are written in upper CamelCase
Constants are written in All Capitals
Use proper spacing and empty lines to make code human readable
CMIS 242 Assignment 3 Temperature Converter
Design and implement Java program as follows:
1) Implement converter class hierarchy as follows:
a. Converter class which includes:
Private attribute for input of data type double
Default constructor with no parameter which sets input to Double.NaN
Overloaded constructor with input for parameter
Get and set methods for input attribute
Method convert() which returns input value
b. TemperatureConverter class which is a child of Converter and includes:
Constructors which call parent constructors
Overridden convert() method to convert input (Fahrenheit temperature) to Celsius and returns the value. If the instance has no input value, it should return Double.NaN
Use the following formula for conversion: C = ((F-32)*5)/9
c. DistanceConverter class which is a child of Converter and includes:
Constructors which call parent constructors
Overridden convert() method to convert input (distance in miles) to distance in kilometers and returns the value. If the instance has no input value, it should return Double.NaN
d. Use the following formula for conversion: KM = M * 1.609
2) Implement GUIConverter class using JFrame and JPanel as follows:
a. GUI will have 3 buttons: “Distance Converter”, “Temperature Converter”, and “Exit”.
b. When user clicks Exit, the program will terminate
c. When user clicks Distance Converter, an input dialog will pop up where user can type value and click OK:
d. Once user clicks OK, message dialog will pop up:
e. When user clicks on Temperature button, an input dialog will pop up to input value and then when clicks OK, the message dialog with pop up with converted result:
f. SUGGESTIONS: For the input dialog you can use JOptionPane.showInputDialog
The ActionListener for each Converter button should create the appropriate Converter child instance, set the input, and call its convert() method For the pop up with converted value you can use JOptionPane.showMessageDialog
CMIS 242 Assignment 2 Gift Basket
Design and implement Java program as follows:
(1) There will be a Gift class with following attributes: order number (combination of numbers and letters), size (values S, M, or L), and price.
(2) There will be two child classes FruitBasket and SweetsBasket with the following additional attributes:
· FruitBasket: number of fruits based on size and may include some citrus fruits indication based on client preference.
· SweetsBasket: may include bags of nuts based on client preference.
(3) The Gift class hierarchy must provide the following functionality:
· On creation [add to ArrayList], a gift instance must be given all attribute values except price which must be calculated and number of fruits or bags of nuts which must be set by system. When adding a new gift include in the prompt for the order number the pattern used for all orders.
· All attribute values can be changed after creation except order number and the values that are calculated or set by the system.
· Price is calculated as follows:
o There is a flat fee of 19.99 for Small gift, 29.99 for Medium gift, and 39.99 for Large gift.
o Fruit basket gift has additional fee of 5.99 when it has citrus fruits.
o Sweets basket gift has additional fee of 4.49 when it has nuts in it.
· Number of fruits in a basket is as follows: Small size has 6 fruits, Medium has 9 fruits, and Large has 15 fruits
· Each class must have a method to return or display the class’s values to the console
(4) The main () element includes the following functionality:
· Instantiation of a Gift class.
· Display a menu for selection.
· Order a gift.
· Change a gift [Find the appropriate id in the array and change the size and/or the added citrus or bag of nuts. Recalculate the price.]
· Display gift. [Display horizontally with order number, type of gift, size, cost, and specifics about the order. e.g., number of fruits or with citrus or nuts.]
(5) There is an array that holds all the orders generated. It is used to find the order number to change values and to display all entries.
(6) Your classes must be coded with correct encapsulation: private/protected attributes, and value validation.
(7) There should be appropriate overloading and overriding methods.
Style and Documentation:
Make sure your Java program is using the recommended style such as:
· Javadoc comment up front with your name as author, date, and brief purpose of the program.
· Comments for variables and blocks of code to describe major functionality {refer to the Documentation of Programs found in Week 1).
· Meaningful variable names and prompts – no single character that is meaningless.
· Class names are written in upper CamelCase
· Constants are written in All Capitals
· Use proper spacing and empty lines to make code more user-friendly, readable.
Capture execution:
You should capture and label screen captures associated with compiling your code and running a passing and failing test cases for each functionality.
Sample run 1:
MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift Basket
4: Display all Gift Baskets
9: Exit program
Enter your selection: 3
No gift has been ordered yet
MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift Basket
4: Display all Gift Baskets
9: Exit program
Enter your selection: 9
Thank you for using the program. Goodbye!
Sample run 2:
MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift Basket
4: Display all Gift Baskets
9: Exit program
Enter your selection: 2
No gift has been ordered yet
Sample run 3:
MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift Basket
4: Display all Gift Baskets
9: Exit program
Enter your selection: 1
Do you want Fruit Basket (1) or Sweets Basket (2): 1
What size do you want: S, M, or L: S
Do you want citrus fruits included? true/false: true
Create order number [FB or SB for type of gift and three integers] FB343
MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift Basket
4: Display all Gift Baskets
9: Exit program
Enter your selection: 3
Order Number: FB343
FB343: A small FruitBasket with 6 Fruits with citrus costing $25.98]
MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift Basket
4: Display all Gift Baskets
9: Exit program
Enter your selection: 2
Current gift size is: Small
What size do you want [enter same size or one of order sizes]? M
Current basket contains citrus.
Do you want citrus fruits included? true/false: false
New order is
FB343: A medium FruitBasket with 9 Fruits with no citrus costing $29.99
MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift Basket
4: Display all Gift Baskets
9: Exit program
Enter your selection: 3
FB343: A medium FruitBasket with 9 Fruits with no citrus costing $29.99
MENU
1: Order a Gift Basket
2: Change Gift Basket
3: Display Gift Basket
4: Display all Gift Baskets
9: Exit program
Enter your selection: 9
Thank you for using the program. Goodbye!
CMIS 242 Assignment 1 Book Inventory
Design and implement Java program as follows:
(1) There will be a Book Java class with following attributes: id, title, and price.
(2) There will be an Inventory Java class which stores and manages a list of Book objects
(3) Inventory class will provide the following functionality:
a. Add: Prompts user for book data and add to the inventory list. If the book already exists
(based on id value), the add request will fail and an error message will be printed to the console
b. Remove. Prompts user for book id, finds the id in the inventory list and removes it. If the
book matching the id is not in the inventory, remove request will fail and an error message will be
printed to the console
c. Find: Prompts user for book id, finds the id in the inventory list and print all the data for
the book (id, title, and price). If the book matching the id is not in the inventory, find request
will fail and an error message will be printed to the console
d. Display: Print all the book information for each book to the console
(4) Implement RunInventory class with main method that will provide the menu with selection for
each above functionality.
Style and Documentation:
Make sure your Java program is using the recommended style such as:
• Javadoc comment up front with your name as author, date, and brief purpose of the program
• Comments for variables and blocks of code to describe major functionality
• Meaningful variable names and prompts
• Class names are written in upper CamelCase
• Constants are written in All Capitals
• Use proper spacing and empty lines to make code human readable
Capture execution:
You should capture and label screen captures associated with compiling your code, and running the a
passing and failing scenario for each functionality
Sample run 1:
MENU
1: Add book
2: Remove book
3: Find book
4: Display all books
9: Exit program
Enter your selection : 4
The inventory has no books
MENU
1: Add book
2: Remove book
3: Find book
4: Display all books 9: Exit program
Enter your selection : 9
Thank you for using the program. Goodbye!
Sample run 2:
MENU
1: Add book
2: Remove book
3: Find book
4: Display all books 9: Exit program
Enter your selection : 1
What is the book id (integer value)? 12345 What is the book price (double value)? 19.98
What is the book title? The end of the civilization
MENU
1: Add book
2: Remove book
3: Find book
4: Display all books 9: Exit program
Enter your selection : 4 Book id= 12345
Book title=The end of the civilization Book price=19.98
MENU
1: Add book
2: Remove book
3: Find book
4: Display all books 9: Exit program
Enter your selection : 9
Thank you for using the program. Goodbye!
CMIS 242 Project 4 Manage a Real Estate Database
The fourth programming project involves writing a program to manage a real estate database. This program should be comprised of an enumerated type, an interface and two classes. The enumerated type should be named Status and should contain three enumeration literals, FOR_SALE, UNDER_CONTRACT and SOLD.
The interface should be a generic interface named StateChangeable and it should have a bounded generic type parameter whose type must be an enumerated type. It should contain one abstract method changeState that has a parameter whose type of the generic type parameter.
The first of the two classes should be named Property. It should implement the StateChangeable interface. It should contain five instance variables, the property address stored as a string, the number of bedrooms, the square footage and the price, all stored as integers, and the status of the property whose type should be the enumerated type Status. In addition, it should have the following three methods:
A constructor that accepts four parameters for the purpose of initializing the characteristics of the property, the address, the number of bedrooms, the square footage and the price. The status of the property should be set to FOR_SALE.
A method named changeState that allows the status of the property to be changed.
An overridden toString method that returns a string containing the property address, the
number of bedrooms, the square footage, the price and the current status, appropriately labeled.
The second class named Project4 should contain the main method. In addition, it should contain an instance variable that defines the database of property records, which is implemented as a TreeMap, with the transaction number field as the key and a Property object as the value. It should generate the GUI shown below:
Clicking the Process button should cause the selected choice of the three database actions in the combo box to its right to be executed. It should first check whether any non integer values have been entered in any of the fields that require integers. If so, an error message should be displayed in a JOptionPane window. The operation should be performed when the user clicks the Process button. If the user attempts to insert a key that is already in the database an error message should be displayed using a JOptionPane message dialog box. If the user attempts to delete or find a record that is not in the database, a message should also be displayed. After each successful operation is completed a JOptionPane window should be displayed confirming the success. In the case of a successful Find request, a window should pop up containing all the information in the associated Property object.
Clicking the Change Status button should cause status of the property association with the designated transaction number to be changed to status selected in the combo box to its right.
Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different kinds of transactions to completely test the program.
CMIS 242 Project 4
You May Also Like:
CMIS 242 Project 1 Minimum Maximum and Average
CMIS 242 Project 2 Computes the Sales Tax
CMIS 242 Project 3 Draws Two Types of Shapes
CMIS 242 Project 3 Draws Two Types of Shapes
The third programming project involves writing a program that draws two types of shapes, ovals and rectangles. This program consists of six classes. The first class is the Shape class, which is an abstract class that extends the predefined Java class Rectangle. It should contain two instance variables, the color of the shape and whether the shape is solid or hollow. It should also contain a class (static) variable that keeps track of how many shapes have been created.. It should have three instance methods, one class method and one abstract method:
1. A constructor that accepts three parameters for the purpose of initializing the characteristics of the shape, a Rectangle object that defines the dimensions and position of the shape, the color of the shape and whether the shape is solid or hollow. It should also update the number of shapes created so far.
2. An instance method named setColor that accepts the Graphics object as a parameter and sets the color for the next draw operation to the color of the current shape.
3. An instance method named getSolid that returns whether the shape is solid or hollow.
4. A class method named getNoOfShapes that returns the number of shapes created so far.
5. An abstract method named draw that accepts a Graphics object as a parameter.
The Shape class has two subclasses. The first is Oval. It should have the following two methods:
1. A constructor that accepts three parameters for the purpose of initializing the characteristics of the shape, a Rectangle object that defines the dimensions and position of the shape, the color of the shape and whether the shape is solid or hollow.
2. An overridden method draw that draws the Oval object on the Graphics object passed as a parameter.
The second subclass is Rectangular. It should have the following two methods:
1. A constructor that accepts three parameters for the purpose of initializing the characteristics of the shape, a Rectangle object that defines the dimensions and position of the shape, the color of the shape and whether the shape is solid or hollow.
2. An overridden method draw that draws the Rectangular object on the Graphics object passed as a parameter.
The fourth class is named Drawing, which should extend the predefined Java class JPanel. It has one instance variable that contains the shape that is currently drawn.. It should have three methods:
1. An overridden paintComponent method that draws the current shape on the Graphics object that is passed to it as a parameter. It should also draw the number of shapes that have been created thus far in the upper left corner.
2. An overridden getPreferredSize method that specifies the dimensions of the drawing panel as 200 pixels wide and 200 pixels high.
3. An instance method named drawShape that is passed the current shape to be drawn. It first checks whether the shape provided will completely fit within the panel. If not, it throws an OutsideBounds exception. Otherwise, it saves the shape in the corresponding instance variable. It then calls repaint to cause that shape to be drawn.
No additional public methods should be included in any of the above classes.
The fifth class named OutsideBounds should define a checked exception.
The sixth class named Project3 should contain the main method. It should generate the GUI shown below:
Image transcription textGeometric Drawing – X Shape Type Oval Shape Drawing Fill Type Solid Color Red Width 100 Height 125 x
coordinate 40 y coordinate 30 Draw
The combo-box for the shape type should allow two choices, either Rectangle or Oval. The combo-box for the fill type should also allow two choices, either Hollow or Solid. The combo-box for the color should allow seven choices, Black, Red, Orange, Yellow, Green, Blue or Magenta.
Clicking the Draw button should first check whether any non integer values have been entered in any of the fields that require integers. If so, an error message should be displayed in a JOptionPane window. Otherwise an appropriate Shape object should be created and passed to the drawShape method of the Drawing class. If that call results in an OutsideBounds exception being thrown, an appropriate error message should be displayed in a JOptionPane window.
Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different kinds of shapes to completely test the program.
CMIS 242 Project 3
You May Also Like:
CMIS 242 Project 1 Minimum Maximum and Average
CMIS 242 Project 2 Computes the Sales Tax
CMIS 242 Project 4 Manage a Real Estate Database
CMIS 242 Project 2 Computes the Sales Tax
A constructor that allows the make and purchase price to be initialized.price.
The second programming project involves writing a program that computes the sales tax for a collection of automobiles of different types. This program consists of four classes. The first class is the Automobile class, which contains the automobile’s make and model, and purchase price, which is specified in whole dollars. It should have three methods:
A method named salesTax that returns the base sales tax computed as 5% of the sales
A toString method that returns a string containing the make and model of the
automobile, the sales price, and the sales tax, appropriately labeled.
The Automobile class has two subclasses. The first is Electric. It has an additional instance variable that contains its weight in pounds stored as an integer. It should have the same three methods:
A constructor that allows the automobile’s make and model, purchase price and weight to be initialized.
An overridden method salesTax that returns the total sales tax. The sales tax for an electric automobile consists of the base sales tax of 5% that applies to all automobiles minus a discount. If the weight is less than 3000 pounds the discount is $200. Otherwise it is $150.
An overridden toString method that returns a string containing the make and model of the automobile, the sales price, sales tax and the weight, appropriately labeled.
The second subclass is Hybrid. It has an additional instance variable that contains the number of miles per gallon stored as an integer. It should have the same three methods:
A constructor that allows the automobile’s make and model, purchase price and miles per gallon to be initialized.
An overridden method salesTax that returns the total sales tax The sales tax for a hybrid automobile consists of the base sales tax of 5% minus a discount. If the number of miles per gallon is less than 40, the discount is $100. Otherwise there is an additional discount of $2 for every mile per gallon in excess of 40.
An overridden toString method that returns a string containing the make and model of the automobile, the sales price, sales tax and the number of miles per gallon, appropriately labeled.
No additional public methods should be included in any of the above three classes.
Finally there should be a fourth class named Project2 that contains the main method. It should generate the GUI shown below:
Image transcription textAutomobile Sales Tax Calculator X Make and Model Sales Price Automobile Type Hybrid Miles per Gallon Electric
Weight in Pounds Other Compute Sales Tax Clear Fields Display Report
After entering the information about the make and model, its sales price and the type of the automobile, clicking the Compute Sales Tax button should display the sales tax in the text field to its right. In addition, the object should be stored in an array of type Automobile. That array should allow space for up to the last five automobiles entered.
If non integer values are entering in any of the fields that require integers, an error message should be displayed in a JOptionPane window.
Clicking the Clear Fields button should clear all text fields.
Clicking the Display Report button should produce a report on the console that includes the information about all the automobiles currently stored in the array. An example of the report that should be displayed is shown below:
Make and Model: Toyota Prius Sales Price: 30000
Sales Tax: 1390.00
Hybrid Vehicle
MPG: 45
Make and Model: Ford Fusion Sales Price: 21000
Sales Tax: 1050.00
Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different kinds of automobiles to completely test the program
CMIS 242 Project 2
You May Also Like:
CMIS 242 Project 1 Minimum Maximum and Average
CMIS 242 Project 3 Draws Two Types of Shapes
CMIS 242 Project 4 Manage a Real Estate Database
CMIS 242 Project 1 Minimum Maximum and Average
The first programming project involves writing a program that computes the minimum, the maximum and the average weight of a collection of weights represented in pounds and ounces that are read from an input file. This program consists of two classes. The first class is the Weight class, which is specified in integer pounds and ounces stored as a double precision floating point number. It should have five public methods and two private methods:
A public constructor that allows the pounds and ounces to be initialized to the values supplied as parameters.
A public instance method named lessThan that accepts one weight as a parameter and returns whether the weight object on which it is invoked is less than the weight supplied as a parameter.
A public instance method named addTo that accepts one weight as a parameter and adds the weight supplied as a parameter to the weight object on which it is invoked. It should normalize the result.
A public instance method named divide that accepts an integer divisor as a parameter. It should divide the weight object on which the method is invoked by the supplied divisor and normalize the result.
A public instance toString method that returns a string that looks as follows: x lbs y oz, where x is the number of pounds and y the number of ounces. The number of ounces should be displayed with three places to the right of the decimal.
A private instance method toOunces that returns the total number of ounces in the weight object on which is was invoked.
A private instance method normalize that normalizes the weight on which it was invoked by ensuring that the number of ounces is less than the number of ounces in a pound.
Both instance variable must be private. In addition the class should contain a private named constant that defines the number of ounces in a pound, which is 16. The must not contain any other public methods.
The second class should be named Project1. It should consist of the following four class (static) methods.
The main method that reads in the file of weights and stores them in an array of type Weight. It should then display the smallest, largest and average weight by calling the remaining three methods. The user should be able to select the input file from the default directory by using the JFileChooser class.
The input file should contain one weight per line. If the number of weights in the file exceeds 25, an error message should be displayed and the program should terminate.
A private class method named findMinimum that accepts the array of weights as a parameter together with the number of valid weights it contains. It should return the smallest weight in that array.
A private class method named findMaximum that accepts the array of weights as a parameter together with the number of valid weights it contains. It should return the largest weight in that array.
A private class method named findAverage that accepts the array of weights as a parameter together with the number of valid weights it contains. It should return the average of all the weights in that array.
Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different input files to completely test the progr
CMIS 242 Project 1
You May Also Like:
CMIS 242 Project 2 Computes the Sales Tax
CMIS 242 Project 3 Draws Two Types of Shapes
CMIS 242 Project 4 Manage a Real Estate Database
CMIS 242 Project 2 ATM Program
A constructor that allows the make and purchase price to be initialized.price.
The second programming project involves writing a program that computes the sales tax for a collection of automobiles of different types. This program consists of four classes. The first class is the Automobile class, which contains the automobile’s make and model, and purchase price, which is specified in whole dollars. It should have three methods:
A method named salesTax that returns the base sales tax computed as 5% of the sales
A toString method that returns a string containing the make and model of the
automobile, the sales price, and the sales tax, appropriately labeled.
The Automobile class has two subclasses. The first is Electric. It has an additional instance variable that contains its weight in pounds stored as an integer. It should have the same three methods:
A constructor that allows the automobile’s make and model, purchase price and weight to be initialized.
An overridden method salesTax that returns the total sales tax. The sales tax for an electric automobile consists of the base sales tax of 5% that applies to all automobiles minus a discount. If the weight is less than 3000 pounds the discount is $200. Otherwise it is $150.
An overridden toString method that returns a string containing the make and model of the automobile, the sales price, sales tax and the weight, appropriately labeled.
The second subclass is Hybrid. It has an additional instance variable that contains the number of miles per gallon stored as an integer. It should have the same three methods:
A constructor that allows the automobile’s make and model, purchase price and miles per gallon to be initialized.
An overridden method salesTax that returns the total sales tax The sales tax for a hybrid automobile consists of the base sales tax of 5% minus a discount. If the number of miles per gallon is less than 40, the discount is $100. Otherwise there is an additional discount of $2 for every mile per gallon in excess of 40.
An overridden toString method that returns a string containing the make and model of the automobile, the sales price, sales tax and the number of miles per gallon, appropriately labeled.
No additional public methods should be included in any of the above three classes.
Finally there should be a fourth class named Project2 that contains the main method. It should generate the GUI shown below:
Image transcription textAutomobile Sales Tax Calculator X Make and Model Sales Price Automobile Type Hybrid Miles per Gallon Electric
Weight in Pounds Other Compute Sales Tax Clear Fields Display Report
After entering the information about the make and model, its sales price and the type of the automobile, clicking the Compute Sales Tax button should display the sales tax in the text field to its right. In addition, the object should be stored in an array of type Automobile. That array should allow space for up to the last five automobiles entered.
If non integer values are entering in any of the fields that require integers, an error message should be displayed in a JOptionPane window.
Clicking the Clear Fields button should clear all text fields.
Clicking the Display Report button should produce a report on the console that includes the information about all the automobiles currently stored in the array. An example of the report that should be displayed is shown below:
Make and Model: Toyota Prius Sales Price: 30000
Sales Tax: 1390.00
Hybrid Vehicle
MPG: 45
Make and Model: Ford Fusion Sales Price: 21000
Sales Tax: 1050.00
Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different kinds of automobiles to completely test the program
CMIS 242 Project 2
You May Also Like:
CMIS 242 Project 1 Minimum Maximum and Average
CMIS 242 Project 3 Draws Two Types of Shapes
CMIS 242 Project 4 Manage a Real Estate Database
CMIS 242 Entire Course
CMIS 242 Entire Course includes:
CMIS242 Project 1 Minimum Maximum and Average
CMIS242 Project 2 Computes the Sales Tax
CMIS242 Project 3 Draws Two Types of Shapes
CMIS242 Project 4 Manage a Real Estate Database
CMIS 242 Project 1
You May Also Like:
CMIS 242 Project 1 Minimum Maximum and Average
CMIS 242 Project 2 Computes the Sales Tax
CMIS 242 Project 3 Draws Two Types of Shapes
CMIS 242 Project 4 Manage a Real Estate Database
CMIS 242 Final Project
The fourth programming project involves writing a program to manage a real estate database. This program should be comprised of an enumerated type, an interface and two classes. The enumerated type should be named Status and should contain three enumeration literals, FOR_SALE, UNDER_CONTRACT and SOLD.
The interface should be a generic interface named StateChangeable and it should have a bounded generic type parameter whose type must be an enumerated type. It should contain one abstract method changeState that has a parameter whose type of the generic type parameter.
The first of the two classes should be named Property. It should implement the StateChangeable interface. It should contain five instance variables, the property address stored as a string, the number of bedrooms, the square footage and the price, all stored as integers, and the status of the property whose type should be the enumerated type Status. In addition, it should have the following three methods:
A constructor that accepts four parameters for the purpose of initializing the characteristics of the property, the address, the number of bedrooms, the square footage and the price. The status of the property should be set to FOR_SALE.
A method named changeState that allows the status of the property to be changed.
An overridden toString method that returns a string containing the property address, the
number of bedrooms, the square footage, the price and the current status, appropriately labeled.
The second class named Project4 should contain the main method. In addition, it should contain an instance variable that defines the database of property records, which is implemented as a TreeMap, with the transaction number field as the key and a Property object as the value. It should generate the GUI shown below:
Clicking the Process button should cause the selected choice of the three database actions in the combo box to its right to be executed. It should first check whether any non integer values have been entered in any of the fields that require integers. If so, an error message should be displayed in a JOptionPane window. The operation should be performed when the user clicks the Process button. If the user attempts to insert a key that is already in the database an error message should be displayed using a JOptionPane message dialog box. If the user attempts to delete or find a record that is not in the database, a message should also be displayed. After each successful operation is completed a JOptionPane window should be displayed confirming the success. In the case of a successful Find request, a window should pop up containing all the information in the associated Property object.
Clicking the Change Status button should cause status of the property association with the designated transaction number to be changed to status selected in the combo box to its right.
Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different kinds of transactions to completely test the program.
CMIS 242 Project 4
You May Also Like:
CMIS 242 Project 1 Minimum Maximum and Average
CMIS 242 Project 2 Computes the Sales Tax
CMIS 242 Project 3 Draws Two Types of Shapes
CMIS 242 Project 4 Manage Student Database
The fourth programming project involves writing a program to manage a real estate database. This program should be comprised of an enumerated type, an interface and two classes. The enumerated type should be named Status and should contain three enumeration literals, FOR_SALE, UNDER_CONTRACT and SOLD.
The interface should be a generic interface named StateChangeable and it should have a bounded generic type parameter whose type must be an enumerated type. It should contain one abstract method changeState that has a parameter whose type of the generic type parameter.
The first of the two classes should be named Property. It should implement the StateChangeable interface. It should contain five instance variables, the property address stored as a string, the number of bedrooms, the square footage and the price, all stored as integers, and the status of the property whose type should be the enumerated type Status. In addition, it should have the following three methods:
A constructor that accepts four parameters for the purpose of initializing the characteristics of the property, the address, the number of bedrooms, the square footage and the price. The status of the property should be set to FOR_SALE.
A method named changeState that allows the status of the property to be changed.
An overridden toString method that returns a string containing the property address, the
number of bedrooms, the square footage, the price and the current status, appropriately labeled.
The second class named Project4 should contain the main method. In addition, it should contain an instance variable that defines the database of property records, which is implemented as a TreeMap, with the transaction number field as the key and a Property object as the value. It should generate the GUI shown below:
Clicking the Process button should cause the selected choice of the three database actions in the combo box to its right to be executed. It should first check whether any non integer values have been entered in any of the fields that require integers. If so, an error message should be displayed in a JOptionPane window. The operation should be performed when the user clicks the Process button. If the user attempts to insert a key that is already in the database an error message should be displayed using a JOptionPane message dialog box. If the user attempts to delete or find a record that is not in the database, a message should also be displayed. After each successful operation is completed a JOptionPane window should be displayed confirming the success. In the case of a successful Find request, a window should pop up containing all the information in the associated Property object.
Clicking the Change Status button should cause status of the property association with the designated transaction number to be changed to status selected in the combo box to its right.
Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different kinds of transactions to completely test the program.
CMIS 242 Project 4
You May Also Like:
CMIS 242 Project 1 Minimum Maximum and Average
CMIS 242 Project 2 Computes the Sales Tax
CMIS 242 Project 3 Draws Two Types of Shapes
CMIS 242 Project 3 Recursion Exercises
The third programming project involves writing a program that draws two types of shapes, ovals and rectangles. This program consists of six classes. The first class is the Shape class, which is an abstract class that extends the predefined Java class Rectangle. It should contain two instance variables, the color of the shape and whether the shape is solid or hollow. It should also contain a class (static) variable that keeps track of how many shapes have been created.. It should have three instance methods, one class method and one abstract method:
1. A constructor that accepts three parameters for the purpose of initializing the characteristics of the shape, a Rectangle object that defines the dimensions and position of the shape, the color of the shape and whether the shape is solid or hollow. It should also update the number of shapes created so far.
2. An instance method named setColor that accepts the Graphics object as a parameter and sets the color for the next draw operation to the color of the current shape.
3. An instance method named getSolid that returns whether the shape is solid or hollow.
4. A class method named getNoOfShapes that returns the number of shapes created so far.
5. An abstract method named draw that accepts a Graphics object as a parameter.
The Shape class has two subclasses. The first is Oval. It should have the following two methods:
1. A constructor that accepts three parameters for the purpose of initializing the characteristics of the shape, a Rectangle object that defines the dimensions and position of the shape, the color of the shape and whether the shape is solid or hollow.
2. An overridden method draw that draws the Oval object on the Graphics object passed as a parameter.
The second subclass is Rectangular. It should have the following two methods:
1. A constructor that accepts three parameters for the purpose of initializing the characteristics of the shape, a Rectangle object that defines the dimensions and position of the shape, the color of the shape and whether the shape is solid or hollow.
2. An overridden method draw that draws the Rectangular object on the Graphics object passed as a parameter.
The fourth class is named Drawing, which should extend the predefined Java class JPanel. It has one instance variable that contains the shape that is currently drawn.. It should have three methods:
1. An overridden paintComponent method that draws the current shape on the Graphics object that is passed to it as a parameter. It should also draw the number of shapes that have been created thus far in the upper left corner.
2. An overridden getPreferredSize method that specifies the dimensions of the drawing panel as 200 pixels wide and 200 pixels high.
3. An instance method named drawShape that is passed the current shape to be drawn. It first checks whether the shape provided will completely fit within the panel. If not, it throws an OutsideBounds exception. Otherwise, it saves the shape in the corresponding instance variable. It then calls repaint to cause that shape to be drawn.
No additional public methods should be included in any of the above classes.
The fifth class named OutsideBounds should define a checked exception.
The sixth class named Project3 should contain the main method. It should generate the GUI shown below:
Image transcription textGeometric Drawing – X Shape Type Oval Shape Drawing Fill Type Solid Color Red Width 100 Height 125 x
coordinate 40 y coordinate 30 Draw
The combo-box for the shape type should allow two choices, either Rectangle or Oval. The combo-box for the fill type should also allow two choices, either Hollow or Solid. The combo-box for the color should allow seven choices, Black, Red, Orange, Yellow, Green, Blue or Magenta.
Clicking the Draw button should first check whether any non integer values have been entered in any of the fields that require integers. If so, an error message should be displayed in a JOptionPane window. Otherwise an appropriate Shape object should be created and passed to the drawShape method of the Drawing class. If that call results in an OutsideBounds exception being thrown, an appropriate error message should be displayed in a JOptionPane window.
Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different kinds of shapes to completely test the program.
CMIS 242 Project 3
You May Also Like:
CMIS 242 Project 1 Minimum Maximum and Average
CMIS 242 Project 2 Computes the Sales Tax
CMIS 242 Project 4 Manage a Real Estate Database
CMIS 242 Project 2 Tax Calculator
A constructor that allows the make and purchase price to be initialized.price.
The second programming project involves writing a program that computes the sales tax for a collection of automobiles of different types. This program consists of four classes. The first class is the Automobile class, which contains the automobile’s make and model, and purchase price, which is specified in whole dollars. It should have three methods:
A method named salesTax that returns the base sales tax computed as 5% of the sales
A toString method that returns a string containing the make and model of the
automobile, the sales price, and the sales tax, appropriately labeled.
The Automobile class has two subclasses. The first is Electric. It has an additional instance variable that contains its weight in pounds stored as an integer. It should have the same three methods:
A constructor that allows the automobile’s make and model, purchase price and weight to be initialized.
An overridden method salesTax that returns the total sales tax. The sales tax for an electric automobile consists of the base sales tax of 5% that applies to all automobiles minus a discount. If the weight is less than 3000 pounds the discount is $200. Otherwise it is $150.
An overridden toString method that returns a string containing the make and model of the automobile, the sales price, sales tax and the weight, appropriately labeled.
The second subclass is Hybrid. It has an additional instance variable that contains the number of miles per gallon stored as an integer. It should have the same three methods:
A constructor that allows the automobile’s make and model, purchase price and miles per gallon to be initialized.
An overridden method salesTax that returns the total sales tax The sales tax for a hybrid automobile consists of the base sales tax of 5% minus a discount. If the number of miles per gallon is less than 40, the discount is $100. Otherwise there is an additional discount of $2 for every mile per gallon in excess of 40.
An overridden toString method that returns a string containing the make and model of the automobile, the sales price, sales tax and the number of miles per gallon, appropriately labeled.
No additional public methods should be included in any of the above three classes.
Finally there should be a fourth class named Project2 that contains the main method. It should generate the GUI shown below:
Image transcription textAutomobile Sales Tax Calculator X Make and Model Sales Price Automobile Type Hybrid Miles per Gallon Electric
Weight in Pounds Other Compute Sales Tax Clear Fields Display Report
After entering the information about the make and model, its sales price and the type of the automobile, clicking the Compute Sales Tax button should display the sales tax in the text field to its right. In addition, the object should be stored in an array of type Automobile. That array should allow space for up to the last five automobiles entered.
If non integer values are entering in any of the fields that require integers, an error message should be displayed in a JOptionPane window.
Clicking the Clear Fields button should clear all text fields.
Clicking the Display Report button should produce a report on the console that includes the information about all the automobiles currently stored in the array. An example of the report that should be displayed is shown below:
Make and Model: Toyota Prius Sales Price: 30000
Sales Tax: 1390.00
Hybrid Vehicle
MPG: 45
Make and Model: Ford Fusion Sales Price: 21000
Sales Tax: 1050.00
Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different kinds of automobiles to completely test the program
CMIS 242 Project 2
You May Also Like:
CMIS 242 Project 1 Minimum Maximum and Average
CMIS 242 Project 3 Draws Two Types of Shapes
CMIS 242 Project 4 Manage a Real Estate Database
CMIS 242 Project 1 Employee Salary
The first programming project involves writing a program that computes the minimum, the maximum and the average weight of a collection of weights represented in pounds and ounces that are read from an input file. This program consists of two classes. The first class is the Weight class, which is specified in integer pounds and ounces stored as a double precision floating point number. It should have five public methods and two private methods:
A public constructor that allows the pounds and ounces to be initialized to the values supplied as parameters.
A public instance method named lessThan that accepts one weight as a parameter and returns whether the weight object on which it is invoked is less than the weight supplied as a parameter.
A public instance method named addTo that accepts one weight as a parameter and adds the weight supplied as a parameter to the weight object on which it is invoked. It should normalize the result.
A public instance method named divide that accepts an integer divisor as a parameter. It should divide the weight object on which the method is invoked by the supplied divisor and normalize the result.
A public instance toString method that returns a string that looks as follows: x lbs y oz, where x is the number of pounds and y the number of ounces. The number of ounces should be displayed with three places to the right of the decimal.
A private instance method toOunces that returns the total number of ounces in the weight object on which is was invoked.
A private instance method normalize that normalizes the weight on which it was invoked by ensuring that the number of ounces is less than the number of ounces in a pound.
Both instance variable must be private. In addition the class should contain a private named constant that defines the number of ounces in a pound, which is 16. The must not contain any other public methods.
The second class should be named Project1. It should consist of the following four class (static) methods.
The main method that reads in the file of weights and stores them in an array of type Weight. It should then display the smallest, largest and average weight by calling the remaining three methods. The user should be able to select the input file from the default directory by using the JFileChooser class.
The input file should contain one weight per line. If the number of weights in the file exceeds 25, an error message should be displayed and the program should terminate.
A private class method named findMinimum that accepts the array of weights as a parameter together with the number of valid weights it contains. It should return the smallest weight in that array.
A private class method named findMaximum that accepts the array of weights as a parameter together with the number of valid weights it contains. It should return the largest weight in that array.
A private class method named findAverage that accepts the array of weights as a parameter together with the number of valid weights it contains. It should return the average of all the weights in that array.
Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different input files to completely test the program.
CMIS 242 Project 1
You May Also Like:
CMIS 242 Project 2 Computes the Sales Tax
CMIS 242 Project 3 Draws Two Types of Shapes
CMIS 242 Project 4 Manage a Real Estate Database
Details
This product is crafted with quality materials to ensure durability and performance. Designed with your convenience in mind, it seamlessly fits into your everyday life.
Shipping & Returns
We strive to process and ship all orders in a timely manner, working diligently to ensure that your items are on their way to you as soon as possible.
We are committed to ensuring a positive shopping experience for all our customers. If for any reason you wish to return an item, we invite you to reach out to our team for assistance, and we will evaluate every return request with care and consideration.
Shop The Full Collection