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
Who prime minister of india​
Alex777 [14]
<h3>\mathfrak\red{✨ Answer :-}</h3>

Mr. Narendra modi is a prime Minister of Indian.

8 0
3 years ago
Read 2 more answers
list the six enternal parts or peripherals of a computer system and identify which are output and which are input devices?
inn [45]
There are many peripheral devices but heres 4 external output ones: monitor, speakers, plotter, and printer. Here are also 4 peripheral input devices: mouse, keyboard, mousepad, and joystick.
3 0
4 years ago
Read 2 more answers
Preparing for jobs that are high in demand allow you to...
quester [9]

Preparing for jobs that are high in demand allows an individual to focus their development of human capital on those careers.

Focus your development of human capital on those careers

<u>Explanation:</u>

As the demand for the job is high, there is no denying the fact that it will increase the likelihood of getting a job. It is a simple proportion, more the number of jobs, more are the chances of getting them.

Last but not least it will also allow an individual to be more attractive to employers in those fields. As an individual prepares for the job, they will acquire certain skills and knowledge that are capable of letting them being perceived as attractive.

7 0
3 years ago
DO NOT JOIN ANY Z O O M MEETINGS FROM THIS PERSON! IS A TRAP Please help me get them banned!!!!!
s2008m [1.1K]

Answer:

how do i help?

Explanation:

7 0
3 years ago
Read 2 more answers
_____________ consists of data that have been processed, organized, and put into context to be meaningful, and to convey underst
Lyrx [107]

Answer:Knowledge

Explanation: Knowledge is the collections of the facts , figure and related data in order to make context regarding any topic. The context of knowledge is organized and formatted in such a manner which can be understood and learnt by the individuals.It is based on the theory or any practical incident to describe the information about it.

E.g.- the remembering of any particular historic incident.

4 0
4 years ago
Other questions:
  • 535 = d +4<br> Whats d?????????????????????<br> &lt;33 thnx babes.
    8·2 answers
  • Which command on the page layout ribbon enables a user to mark where a new page will begin on the printed copy?
    6·1 answer
  • If needed, you can pull over on the shoulder of the freeway to take a break if you are tired. true or false (drivers ed) need as
    11·1 answer
  • True or false: a game design document is like a diary for game developers
    13·2 answers
  • Can you help me in this question
    13·1 answer
  • Write down the functions of network layer in your own words.ASAP
    14·1 answer
  • Which career qualification is unique to the Energy Transmission career pathway and not to the Energy Distribution pathway? color
    10·2 answers
  • Hi, I am from India. Our brainly platform isn't so good, many of 'em keep spamming questions that I ask. US platform seems much
    9·1 answer
  • 4. In computers, an integer can be represented by more than 8-bit, what is the largest positive integer that
    9·1 answer
  • Which of the following security policies can be implemented to prevent removable media from automatically launching potentially
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!