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
Alik [6]
2 years ago
9

The array s of ints contain integers each of which is between 1 and 1000 (inclusive). write code that stores in the variable ord

inals the array of strings consisting of each number followed by its ordinal number abbreviation, "st", "nd", "rd", or "th". for example if s is the array
Computers and Technology
1 answer:
bearhunter [10]2 years ago
7 0

Answer and  Explanation

An array holds a fixed number of values of a single type. Its length is established when the array is created where the length is fixed after the creation.In c programming an array is a collection of data items all of them of the same type and accessed using a common name while in Java  they are items that are dynamically created and all elements have the same type called the component type  of the array.

//takes an array of int and returns an array of String the way you want!  

public String[] setOrdinal(int[] arr)  

{  

String[] ord = new String[arr.length];  

for(int i = 0; i < ord.length; i++)  

{  

ord[i] = convert(arr[i]);  

}  

return ord;  

}  


//takes a number and converts it to string and adds the proper letters


private String convert(int num)  

{  

if(num > 1000 || num <=0)  

return "Not in range";  

else if(num%10==0 || num%10==9 || num%10==8 || num%10==7 || num%10==6 || num%10==5 || num%10==4 || num%10==3)  

{  

return String.valueOf(num) + "th";  

}  

else if(num%10==2)  

{  

if((num/10)%10==1) //checks if the second digit is 1  

return String.valueOf(num) + "th";  

else  

return String.valueOf(num) + "nd";  

}  

else  

{  

if((num/10)%10==1)  

return String.valueOf(num) + "th";  

else  

return String.valueOf(num) + "st";  

}

}

You might be interested in
A data mart is the operational database for the company. group of answer choices true false
netineya [11]

The statement 'a data mart is the operational database for the company' is true.

We can define a data mart as a  subject-oriented database that focuses on a particular area in an organization.

It is through data mart that the employees of a company can access data faster. Data mart, functioning as the operational database, helps employees as they do not have to manually add all the data again. Also, any piece of data needed by an employee can easily be accessed through the data mart of the company.

One of the advantages of using data mart is that it eradicates human-made errors which can arise if data is added manually by an employee.

To learn more about data mart, click here:

brainly.com/question/25013185

#SPJ4

8 0
2 years ago
Which of the following is a windows that allows you to temporarily store text
musickatia [10]
There are no answer choices listed so I don't have anything to choose from so i'm just going to go with what I know/think. Just from reading the question I think it may be the "notepad." If it is not the notepad then it may be the clipboard.

Sorry if this doesn't help you very much, but there were no answer choices. 
7 0
2 years ago
___ is a central part of continuous deployment?
nalin [4]
3 deployment pipeline
7 0
2 years ago
Read 2 more answers
Suppose we have a String object called myString. Write a single line of Java code
VikaD [51]

Answer:

myString=myString.toUpperCase();

Explanation:

In java to change all characters of a string to upper case we use .toUpperCase() method.It will convert string to upper case.

Implementation in java.

import java.util.*;

class Solution

{

public static void main (String[] args) throws java.lang.Exception

{

   try{

Scanner scr=new Scanner(System.in);

System.out.print("Enter a string:");

String myString=scr.nextLine();

myString=myString.toUpperCase();

System.out.println("string in upper case : "+myString);

         }catch(Exception ex){

       return;}

}

}

Output:

Enter a string:hello

string in upper case : HELLO

5 0
3 years ago
What will display after the following code executes?password = 'ILOVEPYTHON'if password.isalpha(): print('Invalid, must contain
Lelu [443]

Answer:

Invalid, must contain one number

Explanation:

The program will assign ILOVEPYTHON to the password variable and start checking the cases stated below.

password.isalpha(): is true for the given password value and the code will execute, the display will show "Invalid, must contain one number." and it will bypass the elif and else statements.

I hope this answer helps.

4 0
3 years ago
Other questions:
  • Mary wants to rearrange the slides of her presentation. Which option should she use?
    9·1 answer
  • When using presentation aids A. make the aid available for the audience to look at throughout the speech. B. prepare to give you
    6·1 answer
  • What is the correct order of network types when categorized by their size or the physical area they cover, from largest to small
    10·1 answer
  • 9. A change in the appearance of a value or label in a cell
    5·1 answer
  • This is for career exploration, I need help please! &lt;3 HELPPPP
    8·2 answers
  • Technician A says that reprogramming a PCM using the J2534 system requires a factory scan tool, while Technician B says it requi
    14·1 answer
  • What is the difference between the byte and short data types in Java?
    7·1 answer
  • ..............................................................................
    8·1 answer
  • The ______ engine compares your entry against its database and returns a list of hits or sites that contain the keywords. (hint:
    8·1 answer
  • The most significant concerns for implementation of computer technology involve _______, security, and ethics. accuracy property
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!