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]
2 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]2 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
You've applied a filter. What's the best way to see the original data?
scoundrel [369]

The answer to your question is,

D. Toggle Filter. You don't want to remove the filter, you just want to see the difference.

-Mabel <3

5 0
3 years ago
Read 2 more answers
A security administrator is reviewing the following information from a file that was found on a compromised host: Which of the f
Roman55 [17]

Answer:

C. Trojan

Explanation:

In Cybersecurity, vulnerability can be defined as any weakness, flaw or defect found in a software application or network and are exploitable by an attacker or hacker to gain an unauthorized access or privileges to sensitive data in a computer system.

This ultimately implies that, vulnerability in a network avail attackers or any threat agent the opportunity to leverage on the flaws, errors, weaknesses or defects found in order to compromise the security of the network.

In this scenario, a security administrator is reviewing the following information from a file that was found on a compromised host: "cat suspiciousfile.txt."

Some of the ways to prevent vulnerability in a network are;

1. Ensure you use a very strong password with complexity through the use of alphanumerics.

2. You should use a two-way authentication service.

3. You should use encrypting software applications or services.

8 0
2 years ago
In Python, if var1 = "Happy" and var2= "Birthday" and var3 = (var 1+var2) *2, then var3 stores the string
nordsb [41]

Answer:

The answer is "Option A".

Explanation:

The program to the given question can be given as:

program:

var1 = "Happy" #defining variable var1

var2= "Birthday" #defining variable var2

var3 = (var1+var2) *2 #defining variable var3 and calculate value

print (var3) #print value.

Output:

HappyBirthdayHappyBirthday

In the above python program, three variable is defined, that is var1, var2, and var3, in which variable var1 and var2 we assign a value, that is "Happy" and "Birthday".

In variable var3 we add the value of var1 and var2 variable and multiply by 2. It will print the variable value two times. and other options are not correct that can be defined as:

  • In option B and C, Both variable var1 and var2 print there values two times but in option B var1 value print two time and var2 value print one time only and option C var1 variable value is print only one time and var2 variable value is print two times that's why it is not correct.
  • In option C, Both variable var1 and var2 print there values two times that's why it is not correct.

7 0
2 years ago
Which of the following items are typically included in a balanced budget A. The amount you earn in income
taurus [48]
D is the correct answer

8 0
3 years ago
Why might you add the Outer Glow effect to text?
-Dominant- [34]

Answer:

nothing it's perfect in the way it is

Explanation:

4 0
2 years ago
Other questions:
  • Electrical pressure is also called
    5·2 answers
  • The acronym is used to define the process that allows multiple devices to share a single routable ip address.
    6·1 answer
  • Your boss asks you to work through the weekend to install new software on the applications server that serves up applications to
    15·2 answers
  • A matrix representation stores matrices such that the offset address of the element in row i and column j can be calculated by c
    12·1 answer
  • What is indentation?
    8·2 answers
  • The IT department sent out a memo stating that it will start delivering desktop computer interfaces through the IT data center v
    5·1 answer
  • Is anyone really good at immerse 2 learn??
    9·1 answer
  • Nonprogrammed decision
    7·1 answer
  • Need answer ASAP!!!!
    14·1 answer
  • Suggest names for a coding club
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!