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
Wich type of operating system is usually used in personal computers
Anvisha [2.4K]
The three most common operating systems for personal computers are Microsoft Windows, Apple Mac OS X, and Linux.
4 0
3 years ago
Read 2 more answers
What are your two biggest strengths as a student? How will these strengths help you become a self-directed learner?
zavuch27 [327]

Answer:

5tgggffyfghfh jrhrhek

7 0
3 years ago
Read 2 more answers
The process of ensuring that web pages coded with new or advanced techniques still are usable in browsers that do not offer supp
Leya [2.2K]

Answer:

(C) progressive enhancement

Explanation:

Progressive enhancement is a web design technique that first underlines the main functionality web page and then incorporates increasingly enhanced and advanced features and design levels.

This process enables the users to use and access the basic features of the web pages. These users can use any browser to access the main contents of the web page. Progressive Enhancement also offers an advanced version of the website for those with more advanced and sophisticated computer browsers or faster internet connection.

So the user can access basic features of a web sites as well as the complex features. This process first makes sure the basic intended purpose and main contents of the web site is accessible to all users before adding complex features which are supported by different browsers and devices.

Validation is a process which checks that code of the website is as per the world wide web standards and also checks that content of web pages and design of websites is being properly displayed and the site is accessible. So this is not the correct option.

Technique of altering a web site in a way that it can appear higher in the search engine results is called optimization so this is not a correct option.

7 0
3 years ago
When creating a presentation in Libre Office Impress, where does the editing of slides take place?
kondor19780726 [428]
The Canterbury Tales, written towards the end of the fourteenth century by Geoffrey Chaucer, is considered an estates satire because it effectively criticizes, even to the point of parody, the main social classes of the time. These classes were referred to as the three estates, the church, the nobility, and the peasantry, which for a long time represented the majority of the population.
4 0
3 years ago
What function would you use to calculate the total interest paid for the first year of a mortgage?.
WITCHER [35]

Answer:

To calculate the total interest paid for the first year of a mortgage, the formula M = [P.r (1+r)n] / [(1+r)n-1] × 12 can be used.

Explanation:

3 0
2 years ago
Other questions:
  • Question 16 (2 points) Question 16 Unsaved
    11·1 answer
  • Can somebody explain me what this code does in a few or one sentence?#include #include using namespace std;int main () { const i
    12·1 answer
  • ______ is using material created by others without obtaining permission from the original authors.
    10·2 answers
  • List and describe four communication tools that are currently popular.
    9·1 answer
  • Who initially developed what is now known as the internet?
    5·1 answer
  • The term that refers to the standard computer language for creating web pages is called:
    6·1 answer
  • An algorithm is:
    14·1 answer
  • Which of the following is NOT a factor of identifying graphic design?
    10·2 answers
  • ❤️❤️Please answer the six questions ✨BRAINIEST✨ For correct answer ❤️❤️
    7·1 answer
  • What is the difference between
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!