In-Class Assignment (IC) #08 - Friday In-Class Assignment (IC) #08 - Friday Due Apr 17 by 9am Points 6 Submitting a text entry box or a file upload Available after Apr 10 at 9am Submit Assignment Java...

This is for Intro to Computer Science I: Java


In-Class Assignment (IC) #08 - Friday In-Class Assignment (IC) #08 - Friday Due Apr 17 by 9am Points 6 Submitting a text entry box or a file upload Available after Apr 10 at 9am Submit Assignment Java Project Name: IC08_CreditCard Design and implement the Java code for a class to represent a credit card. Its attributes (member or instance variables) are: network - An String consisting of one of the 4 major networks (Amex, Discover, Mastercard or Visa) number - The credit card number (String) cardHolder - The name of the credit card holder (owner) (String) expirationDate - The expiration date of the credit card (String) securityCode - The security code associated with the card (int) The Credit class will have methods to: Create a new CreditCard (given a network, card holder name, number, expiration date and security code) [constructor] getCardHolder getExpirationDate getNetwork getNumber setCardHolder equals [method to check if one CreditCard is the same as another] toString [method to turn CreditCard into a string for display], for example: Credit Card [VISA, ************6789, Michael Paulding, 12/2023] (note that the credit card number only shows the last 4 digits and security code is not displayed at all) ***Be sure to demonstrate that your class performs as specified by instantiating at least one new CreditCard object in the main method and testing the mutator (setter) method*** Here is a UML class diagram to help with the design: Java Project Name: IC08_GetToThePoint Implement a class named Point that represents a two-dimensional point, with an x and y value. The Point class should have the following member variables (a.k.a. fields or instance variables): x (the x-value of the point, as a whole number) y (the y-value of the point, as a whole number) The Point class will have methods to: Create a new Point (given an x-value and y-value) [constructor] Create a new Point (with no parameters) [default constructor] Create a new Point (from another Point) [copy constructor] getX getY setX setY distanceTo(Point otherPoint) equals [method to check if one Point is the same as another] toString [method to turn a Point into a string for display, e.g. display as "Point[x=0,y=5]" if the x-value is 0 and y-value is 5] The distanceTo method can be implemented with the following equation for distance: Now, implement a class named Line that represents a two-dimensional line, consisting of two points. The Line class should have the following instance variables (a.k.a. fields or data): p1 (the first Point of the line) p2 (the last Point of the line) The Line class will have methods to: Create a new Line (from two x-values and two y-values) [constructor] Create a new Line (from two Points) [constructor] Create a new Line (from another Line) [copy constructor] getP1 getP2 getX1 getY1 getX2 getY2 setP1 setP2 setX1 setY1 setX2 setY2 length() [method that calculates the length of the Line] equals [method to check if one Line is the same as another] toString [method to turn a Line into a string for display, e.g. display as "Line[(x1=0,y1=5), (x2=0,y2=10)]" ***Be sure to demonstrate that your classes perform as specified by creating a driver program (e.g. IC07_PointLineDemo.java) to test each method*** Java Project Name: IC08_Temperature Implement a class named Temperature that represents a temperature in either Fahrenheit or Celsius. Allow the degrees to have decimal places (e.g. double) and use an String to store the unit. Specifically, the Temperature class has the following member variables (a.k.a. fields or data): The degrees (double) The unit (String) The Temperature class will have methods to: Create a new Temperature (given a value for degrees and unit) [parameterized constructor] Create a new Temperature (given no parameters - initialize Temperature to 0.0 degrees Celsius) [default constructor] Create a new Temperature (from another Temperature) [copy constructor] getDegrees getUnit setDegrees setUnit convertTo(String otherUnit) - this method will convert a degree in one unit to a degree in another (e.g. Fahrenheit to Celsius) and returns true if a conversion was made, false otherwise (the only way a conversion is not made is if the units are the same (e.g. Fahrenheit to Fahrenheit) toString - method to turn a Temperature into a string for display, e.g. display as "Temperature [0.0 degrees Celsius]" **Create a driver class (TemperatureDemo) to make two temperature objects (in Celsius and Fahrenheit), two of which are the same essential temperatures, but in different units. Check the two equivalent temperatures for equality. Print both temperatures to the console.*** Below is a class diagram showing the fields and methods of the Temperature class:
May 13, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here