answer.
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]
1 year 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]1 year 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
Explain why Windows and Linux implements multiple locking mechanisms. Describe the circumstances under which they use spinlocks,
galben [10]

Answer:

The description for the given question is described in the explanation section below.

Explanation:

Depending on the needs of the device programmers these OS have various locking frameworks. Spinlocks become beneficial for preemptive multitasking processes during which a thread will operate in such an active loop instead of risking a rest queue latency. Mutexes become beneficial to utility lockers.

  • Solaris 2 employs flexible mutexes, indicating something like this on preemptive multitasking computers, the mutex is introduced with either a spinning switch.
  • Semaphores and state variations are much more effective methods for consistency where a commodity needs to be managed for such a prolonged period of time because spinning is unstable over a prolonged time.

8 0
1 year ago
A computer application such as Microsoft Access that is used to store data and convert it into information is a ________________
lorasvet [3.4K]
All data is stored in table
5 0
2 years ago
The Tell Me feature also includes access to the _____ feature.
Ierofanga [76]

Answer:

the quick access toolbar can be customized to include additional commands such as. -"tell me what you want to do" box ... custom programs or additional commands that extend the functionality of a Microsoft office program ... in the open window. it also includes ribbon display options and control buttons that enable you to ...

Explanation:

7 0
2 years ago
Jeff wants to be an archeologist. He found the information below and wants to properly cite it for his own use. The information
saw5 [17]
<span>“Detail Report for 15-1199.11-Archeologist.” O*NET OnLine. n.p., 2012. Web. 5 May 2013.</span>
7 0
1 year ago
Read 2 more answers
This is the recorded history of the development of a group functioning within an organization. Identify the sentence that refers
Vikentia [17]
This is the recorded history of the development of a group functioning within an organization. Identify the sentence that refers to the norming stage of group development.

. The group then created a working structure that everyone agreed with.

5 0
2 years ago
Read 2 more answers
Other questions:
  • Which statement best describes how the rapid prototyping model works?a) Developers create prototypes to show stakeholders how va
    11·2 answers
  • Which of these is an advantage of using the Clipboard task pane? A. You are able to apply OLE easily. B. There are more paste op
    15·2 answers
  • Initialize the list short_names with strings 'Gus', 'Bob', and 'Zoe'. Sample output for the givenprogram:Gus Bob Zoeshort_names
    13·1 answer
  • Software as a Service (SaaS) refers to the use of computing resources, including software and data storage, on the Internet rath
    13·1 answer
  • Write a client program that writes a struct with a privateFIFO name (call it FIFO_XXXX, where XXXX is the pid that you got from
    11·1 answer
  • How many times does the following loop execute?int upperCaseLetters = 0;String str = "abcdEfghI";boolean found = false;for (int
    5·1 answer
  • 4. When emergency changes have to be made to systems, the system software may have to be modified before changes to the requirem
    13·1 answer
  • #Write a function called fancy_find. fancy_find should have #two parameters: search_within and search_for. # #fancy_find should
    9·1 answer
  • Which group contains the command to manually conduct a spell check ?
    9·1 answer
  • The word “computer” has become associated with anything related to screens and keyboard. However, these are not the only parts t
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!