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
Verdich [7]
3 years ago
6

In Java

Computers and Technology
1 answer:
liubo4ka [24]3 years ago
5 0

Answer:

class Main {

 public static String numToText(int digit) {

   String[] numbers = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};

   return numbers[digit % 10];

 }

 public static void main(String[] args) {

   for(int i=0; i<10; i++) {

     System.out.println(i+" = "+numToText(i));

   }

 }

}

Explanation:

I clip the input on being 0-9 by taking it modulo 10. You could also create error handling for that if desired.

You might be interested in
Write a Java method onlyDigits that takes a string as a parameter. The method should remove from the string all characters, whic
Stels [109]

Answer:

public static String onlyDigits(String in){

    String digitsOnly = in.replaceAll("[^0-9]", "");

    return digitsOnly;

}

A Complete program is wrtten in the explanation section

Explanation:

public class TestClass {

   public static void main(String[] args) {

     String a = "-jaskdh2367sd.27askjdfh23";

       System.out.println(onlyDigits(a));

}

public static String onlyDigits(String in){

    String digitsOnly = in.replaceAll("[^0-9]", "");

    return digitsOnly;

}

}

The output: 23672723

The main logic here is using the Java replaceAll method which returns a string after replacing all the sequence of characters that match its argument, regex with an empty string

3 0
3 years ago
Which of the following describes the phishing method of information security crime?
Marianna [84]
<span>C. pretending to be someone else when asking for information</span>
3 0
3 years ago
Read 2 more answers
Write a program called DeliveryCharges for the package delivery service. The program should use an array that holds the 10 zip c
Vlad [161]

Answer:

import java.util.Scanner;

public class DeliveryCharges

{

public static void main(String[] args) {

 

       String[] zips = {"01234", "11234", "21234", "31234", "41234", "51234", "61234", "71234", "81234", "91234"};

    double[] prices = {2.2, 1.0, 3.6, 6, 9, 7.1, 0.8, 4.7, 3.3, 5.2};

    int index = -1;

    Scanner ob = new Scanner(System.in);

    System.out.print("Enter the zip code for your delivery: ");

    String zip = ob.next();

   

    for (int i=0; i<10; i++) {

        if (zip.equals(zips[i])) {

            index = i;

        }

    }

       

    if (index!= -1)

       System.out.println("Delivery charge to " + zips[index] + " is: " + prices[index]);

    else

       System.out.println("No delivery to " + zip);

}

}

Explanation:

Initialize the zips and prices

Initialize index that represents the index of the zip code. If the entered zip code is in the array

Ask the user to enter the zip code

Create a for loop that iterates through the zips. If the entered zip is in the zips, set its index to index

When the loop is done, check if the index. If the index is not -1, that means zip code was found in the zips array, print the corresponding price from the price array. Otherwise, print no delivery for the entered zip code

8 0
4 years ago
Clicking the _____ opens the insert function dialog box shown in the accompanying figure.
stiks02 [169]
Clicking the insert function box on the formula bar <span>opens the insert function dialog box shown in the accompanying figure.</span>
8 0
3 years ago
A communications objective is
Kazeer [188]

Answer:

They are used to identify your audience, craft messages and evaluate results. Communication Objectives are - as the name suggests – the process of setting targets for communication.Changing company or brand perceptions is another common communication objective.

Hope this helps! If so please mark brainliest and rate/heart to help my account

8 0
4 years ago
Other questions:
  • In your Ice Breakers game, when does the player lose a life?
    6·2 answers
  • PLEASEEEEEEEEEEEEEEEEE HELPPPPPPPP
    15·1 answer
  • Which of the following is a scam where perpetrators promise high pay for working on different projects like wooden calendars, pa
    13·1 answer
  • Which careers have the highest minimum experience requirement?
    14·1 answer
  • So whenever I play among us, I always get killed. Like always. I want to know some Technics to being a crew mate and an impostor
    9·1 answer
  • Order the steps for accessing the junk email options in Outlook 2016
    9·2 answers
  • In MS Word we can merga cells true or false​
    13·2 answers
  • WAp to input the radius and print<br> the area of circle
    15·1 answer
  • 2.13.4 Colorful Caterpillarhel ????
    15·1 answer
  • When it comes to game mechanics, what is the most universal mechanic that is present in virtually every computer game that you c
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!