1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
givi [52]
3 years ago
11

The user interface contains two types of user input controls: TextInput, which accepts all characters and Numeric Input, which a

ccepts only digits.
1. Implement the class TextInput that contains:
O Public method def add(c : Char) - concatenates the given character to the current value
O Public method def getValue(): String - returns the current value
Implement the class NumericInput that:
O Inherits from TextInput
O Overrides the add method so that each non-numeric character is ignored
For example, the following code should output "10":
$input = new NumericInput();
$input->add('1');
$input->add('a');
$input->add('0');
echo $input->getValue();
The code skeleton is provided below:
<?php
class TextInput
{
}
class Numericinput
{
{
//$input = new NumericInput();
//$input->add('1');
//$input->add('a');
//$input->add('0');
//echo $input->getValue();
Computers and Technology
1 answer:
Shtirlitz [24]3 years ago
4 0

Answer:

Explanation:

public class Main

{

private static String val; //current val

public static class TextInput

{

public TextInput()

{

val= new String();

}

public void add(char c)

{

if(val.length()==0)

{

val=Character.toString(c);

}

else

{

val=val+c;

}

}

public String getvalue()

{

return val;

}

}

public static class NumericInput extends TextInput

{

Override

public void add(char c)

{

if(Character.isDigit(c))

{

//if character is numeric

if(val.length()==0)

{

val=Character.toString(c);

}

else

{

val=val+c;

}

}

}

}

public static void main(String[] args)

{

TextInput input = new NumericInput();

input.add('1');

input.add('a');

input.add('0');

System.out.println(input.getvalue());

}

}

You might be interested in
List with ecamples five important applications areas of computer today​
Andrew [12]

Answer:

Banking

Education

Business

Engineering and Architectural designs

Health

Explanation:

Banking : Shifting from the manual method of having to input information into hard book ledgers. Data and payment information can now be stored on computers. This may be used to prevent information duplication, forecasting and efficient payment purposes.

Education : With the use of computers today, students can now take computer based tests which are not only easily accessible and curtails geographical issues, they are also faster.

Business : With computers, businesses can now manage and their store customer information, inventory management and sales tracking.

Engineering and Architectural designs : With computers, thesw fields can now boast of computer aided designs which allows experts produce both 2 and 3 - dimensional prototype of equipments, buildings, building plans or other engineering structures.

Health : Adequate health record, patient appointment, digitally monitored pulse rate are some of the uses of computers in medicine.

5 0
3 years ago
which of the following is involved in ordering an outline. A.grouping B.merging C.organizing D.arranging
Svetllana [295]

Answer:

The answer is A.GROUPING

HOPE THIS HELPS...

4 0
3 years ago
Imagine your friend wants to apply
mojhsa [17]
What do ur friend wants to apply for ?
7 0
4 years ago
2. Which company was first able to send a text? (Verizon, AT&amp;T, Cricket???)
zheka24 [161]

Answer:

I would say Nokia

Explanation:

Nolia was the first to create an SMS text message in 1993.

sorry if I am wrong :c

3 0
3 years ago
What type of stone was the most common building material of royal pyramid?
eimsori [14]
I think it's low grade lime stone..
6 0
3 years ago
Other questions:
  • The compare_strings function is supposed to compare just the alphanumeric content of two strings, ignoring upper vs lower case a
    15·1 answer
  • Krista needs to configure the default paste options in PowerPoint 2016. Which area of the Options dialog box will she need to us
    14·1 answer
  • Advantages of a personal area network
    5·1 answer
  • Which option marks all modification made within a document? Review Comment Track Changes Balloons
    15·2 answers
  • Burtex Inc. is an application development organization. Twenty five of its knowledgeable employees are retiring in the upcoming
    6·1 answer
  • First identify the formula to compute the sales in units at various levels of operating income using the contribution margin app
    12·1 answer
  • Who would win in a fight iron man or bat man​
    5·2 answers
  • A _______ is a website specially designed to allow visitors to use their browser to add, edit, or delete the site's content.
    9·2 answers
  • Pascal system . write the program that will calculate the perimeter of a rectangle if its area is A (m²) and one of its sides ha
    6·1 answer
  • Interactivity and Blank______ are two important capabilities of the Internet in the Blank______ relationship.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!