Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, Need help with the next following questions please. Question 1 (I HAVE SOLVED THIS, DO NOT NEED TO FOCUS ON THIS) develop a class

Hi,

Need help with the next following questions please.

Question 1 (I HAVE SOLVED THIS, DO NOT NEED TO FOCUS ON THIS)

develop a class calledCreditCardCheckerin this project. You will develop this class in the following parts.

In the class that is created, delete the example instance variable, the line of code in the constructor that assigns0to the variable, and the sample method. Also remove any comments related to the variable and the sample method.

Retain the class comment but edit to it include your own name and the date. For the description of the class write 'Answer to TMA01 Question 1'.

MY SOLUTION FOR THIS IS:

/**

* Answer to Question 1

* @author Georgina

* @version 05/12/2020

*/

public class CreditCardChecker

{

public CreditCardChecker()

{

}

}

I NEED HELP ON THIS BIT PLEASE.

In the class CreditCardChecker:

i. Declare the longNumber instance variable as a String

ii. Edit the constructor forCreditCardCheckerso that it takes a singleStringargument and sets the instance variablelongNumberto the string represented by this argument.

iii.Develop a getter method forlongNumber.

Compile your class and then develop an object of the classCreditCardCheckerin the OUWorkspace, passing the constructor the string"4916592478445662".

Test your getter method by sending an appropriate message to your object and checking the output in the Display Pane. If you are not sure how to do the test, please see the projectREADME.TXTfile for example test code. In the test code, we used the identifiercccfor ourCreditCardCheckerobject.

Include a screenshot of the workspace showing your completed tests in yourSolution Document.

README.TXT

PROJECT TITLE: CreditCardChecker

PURPOSE OF PROJECT: To check the validity of long credit card numbers

AUTHORS: Module Team

USER INSTRUCTIONS:

// code to evaluate in the workspace for Q1 (a)

CreditCardChecker ccc = new CreditCardChecker ("4916592478445662") ;

ccc.getLongNumber () ;

//Credit card numbers to check

"272099998564591" // not valid (too short)

"2720999985645912" // not valid - calculated check digit is 8

"5266509258235496" // could be valid

"5266590258235496" // could be valid

"4916618655349234" // not valid - calculated check digit is 5

"4485735287746637" // could be valid

"4365300588292181483" // not valid - too long

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

What are the barriers for entering Western markets with Tata nano?

Answered: 1 week ago