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
What are the different types database of end users? Discuss the main activi-ties of each
disa [49]

Answer:

following types of databases available in the market −

Centralised database.

Distributed database.

Personal database.

End-user database.

Commercial database.

NoSQL database.

Operational database.

Relational database.

Cloud database.

Object-oriented database.

Graph database

8 0
3 years ago
Read 2 more answers
Select the correct navigational path to create the function syntax to use the IF function.
Harrizon [31]

Answer:

1. Logical

2.=

3.IF

Explanation:

just did the assignment

3 0
4 years ago
Read 2 more answers
Which setting on a profile makes a tab NOT accessible in the All App Launcher or visible in any app, but still allows a user to
Levart [38]

Answer:

freezer

Explanation:

you can freeze your application and it won't show on your launcher till you unfreeze it

5 0
3 years ago
Select the correct answer.
Naddika [18.5K]

Answer:

E

Explanation:

4 0
3 years ago
Pleas help with this question: Which statement about word processing software is true?
deff fn [24]
Short Answer C

The Primary use of any word processor is to create word documents (like this editor) with the ability to format it with bold letters or <u>underlining</u> or <em>italics</em>. There are many other choices of things to do. All your choices are true but the main one is the third one down.

It can do very simple mathematical calculations if it can create tables (neither of which is possible with this editor. A is incorrect.

D is mostly incorrect. Very few word processors have built in capabilities that would help you with word games. There are some that do. Most don't.

I would hate to create fonts using a word processor. It's remotely possible, but anyone in his right mind would try using a program designed for that.. B is incorrect.
8 0
4 years ago
Other questions:
  • Is I5 9100 is better than i5 9400
    6·1 answer
  • Explain the term DNS(Domain Name System) and why it is used.
    9·1 answer
  • This inventor made their own fortune. They had little to no help in become one of the first black millionaires. They invented a
    9·1 answer
  • Name a device, app or website then give features of the app that make it addictive and humane. (3 details for each)
    5·1 answer
  • Before you ever buy your first stock or bond, it's important to understand what type of investor you are. This depends on a numb
    12·1 answer
  • Ict quiz I attached a picture
    11·2 answers
  • CSCU EXAM TEST FINAL1-A software or hardware that checks information coming from the Internet and depending on the applied confi
    6·1 answer
  • Research the significance of the UNIX core of macOS and write a few sentences describing your findings.
    8·1 answer
  • Computer science is a blank process
    6·2 answers
  • MODERATOR DELETE MY ACC
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!