/* missing precondition */

public String getChar(String str, int n) {

return str.substring(n, n 1); }

Write down the most appropriate precondition for the method so that it does not throw an exception.

Answers

Answer 1

Answer:

An appropriate precondition is:

0 <= n && n <= str.length() - 1

Explanation:

Required:

Write down an appropriate pre-condition for the program

From the question, we understand that the method accepts two parameters:

str -> A string value

n -> An integer value which represents the index of character to return from the string str

It should be noted that:

n must be within the range of 0 and str.length()-1

Take for instance:

str = "ABCDE";

n must be within the range 0 to 4 (inclusive) in order not to raise an exception. This is so because the string index starts at 0 and stops at 1 less than the length of the string.

Hence, the precondition can be written as:

0 <= n && n <= str.length() - 1

Which means: n = 0 to length - 1


Related Questions

* HELP FAST*Which Section do you need to go on in the Ribbon, to get to the button that will allow you Create a Link between text boxes?

Answers

Answer:

Insert

Explanation:

Take with a pinch of salt cuz I'm not a coder or anything, but I've got a few skillz.

6.2 lesson practice

Answers

Answer:

I am guessing it would be 20

Explanation:

In the draw canvas text code the last number from the color is probably the font size.

Correct me if I'm wrong

Five Star Retro Video rents VHS tapes and DVDs to the same connoisseurs who like to buy LP record albums. The store rents new videos for $3.00 a night, and oldies for $2.00 a night.Write a program that the clerks at Five Star Retro Video can use to calculate the total charge for a customer’s video rentals.

Answers

Answer:

The total cost is $13.0

Explanation:

Five Star Retro Video rents VHS tapes and DVDs to the same connoisseurs who like to buy LP record albums. The store rents new videos for $3.00 a night, and oldies for $2.00 a night.

Write a program that the clerks at Five Star Retro Video can use to calculate the total charge for a customer's video rentals.

The program should prompt the user for the number of each type of video and output the total cost.

HELP AASAP BRAINLIEST JUST HELP

Answers

Answer:

d

Explanation:

plz brainliest

Intrusion Detection System (IDS) is a security mechanism that detects unauthorized user activities, attacks, and network compromises.

a. True
b. False

Answers

Answer: True

Explanation:

The Intrusion Detection System (IDS) is used for the detection of malicious activities and thus is done by monitoring if the network communications and also the examination of systems logs.

When something looks suspicious of fishy, the Intrusion Detection System scans such thing out. When violations of policy occurs, the Intrusion Detection System is at alert to notice.

Therefore, the answer to the statement in the question is true.

Finish the program to compute how many gallons of paint are needed to cover the given square feet of walls. Assume 1 gallon can cover 350.0 square feet. So gallons = the square feet divided by 350.0. If the input is 250.0, the output should be:

0.714285714286

Answers

Answer:

gallons_paint = wall_area / 350.0

Explanation:

So gallons = the square feet divided by 350.0:

So gallons = gallons_paint

the square feet = wall_area

then divide by 350.0

the whole thing:

wall_area = float(input())

# Assign gallons_paint below

gallons_paint = wall_area / 350.0

print(gallons_paint)

The program to compute how many gallons of paints are needed to cover the given square feet's of walls is as follows:

def square_feet_to_gallons(area):

  gallons = area / 350

  return gallons

print(square_feet_to_gallons(250))

1 gallon covers 350 square feet.

Therefore, gallons = area / 350

The user inputs is the area in square feet. Then the output should be the number of gallons.

The code explanation python.

We declared a function named square_feet_to_gallons and the argument is area.

Then we declared a variable and assigned the mathematical operation area/350 to it.

Then we return the gallons.

Finally, we call the function with a print statement.

learn more on programming here:https://brainly.com/question/14469650?referrer=searchResults

being the server administrator how often will you conduct a server maintenance?

Answers

Weekly server checks

Nonetheless, a weekly check is essential. Another check you should do weekly or even every two weeks is your disk usage. Again, disk usage rarely suddenly changes so it's not something you need to check every day. However running out of disk space can mean that your server breaks down.

System software is software that allows users to do things like create text documents, play games, listen to music or web browsers to surf the web. True or False
O True
O False

Answers

Answer:

False

Explanation:

System software is the collection of programs that controls and manage the operation of a computer.

System software is software that allows users to do things like create text documents, play games, listen to music or web browsers to surf the web is a false statement.

What is the software about?

A system software is made up of software development tools but software that gives room for users to create text documents, play games, listen to music, or others are known to be application software.

Therefore, System software is software that allows users to do things like create text documents, play games, listen to music or web browsers to surf the web is a false statement.

Learn more about System software from

https://brainly.com/question/24321656

#SPJ6

12. What was the trade Howard offered to Death?​

Answers

Answer:

His life

Explanation:

Quick please, URGENT

1.Explain why the scenario below fails to meet the definition of due diligence in coding.

Situation: As you are developing an app for a small fee, you include access to many other services, such as searching the Internet.


3.A programmer must know platforms and other languages. On what "side" is Groovy?

programmer side

Web-based side

server-side

client-side

4.Give two reasons why there are more contract workers than permanent workers

5.Explain why the scenario below fails to meet the definition of an app with persona.

Situation: Jim built an app for a company in which the user navigates a Web site by clicking on links and reading written material.

6.Explain why the scenario below is not a description of an angel investor.

Situation: Ray has an idea for developing an app and finds individuals who will invest in the app. These individuals sign an agreement that they expect no money or rights in the app.

7.In an app design project, who is responsible for the SDKs?

the programmer

the developer

the senior executive

the senior staff

8.Suppose you are offered a position that focuses on writing policies, hiring staff, and focusing on the company's mission. What position are you offered?

legal executive

technology executive

resources executive

programming executive

Answers

Answer: it is the code it is wrong

Explanation:

File
Home
Insert
Formulas
Data
Review
View
Automate
Help
Editing
Calibri Light
16
B
Bra Av
2
CS
General
G
A
B
С
D
E
F
L
H
1
3
3 In cell D7, create a formula that calculates the tax for the invoice. Us
a
sales tax rate of 7.5%
SABROSA
Catering Invoice
Sabrosa Empanadas & More
1202 Biscayne Bay Drive
Orlando, FL 32804
Invoice #:
6710A Date:
10/15/20
In cell Ds, create a formula that finds the total for the order. In other
this formula should add cells D3:07.
Empanadas & More
1
In cell D9 create a formula that calculates the total after a 10% disco
you need help understanding how to take a percentage off of a total
LINE TOTAL
2 MENU ITEM
3 Empanadas: Buffalo Chicken
4 Empanadas: Braised Short Rib
5 Empanadas: Fig and Goat Cheese
6 Sides: Black beans and rice
7
UNIT PRICE
$2.98
$2.98
$3.75
$1.98
QUANTITY
20
30
25
40
TAX
8
TOTAL
TOTAL AFTER DISCOUNT:
9
+
Catering Invoice Catering Subtotal challenge
C Mode tomate Workbook to
Helo improve Office
100%
-

Answers

Explanation:

formula should add cells D3:07.

Empanadas & More

1

In cell D9 create a formula that calculates the total after a 10% disco

you need help understanding how to take a percentage off of a total

LINE TOTAL

2 MENU ITEM

3 Empanadas: Buffalo Chicken

4 Empanadas: Braised Short Rib

5 Empanadas: Fig and Goat Cheese

6 Sides: Black beans and rice

7

UNIT PRICE

$2.98

$2.98

$3.75

$1.98

QUANTITY

20

30

25

40

TAX

8

TOTAL

sadfsdfsdfasdfsafdsafaf

Answers

Sjciientngjfjrjbshxjejcicknrco

Write a program that takes a first name as the input, and outputs a welcome message to that name.
Ex: If the input is Pat the output is:
Hello Pat and welcome to cs Online
Input Welcome message
1 user_name = input 2 3
Type your code here

Answers

Answer:

The program in Python is as follows:

user_name = input("Name: ")

print("Hello "+user_name+" and welcome to cs Online")

Explanation:

The program is written in Python, and it uses basic input and output function to execute the instruction in the question.

First: Prompt the user for username

This is done in the following line

user_name = input("Input your name: ")

Next, the print function is used to output the welcome message

print("Hello "+user_name+" and welcome to cs Online")

The program that takes first name as the input, and outputs a welcome message to that name is represented below:

user_input = str(input("please type your first name: "))

print(f" Hello {user_input} !! Welcome to CS online ")

The code is written in python.

The variable user_input is used to store the user's input. It ask the user for his/her first name and store it.

Then we print the welcome statement using the f string.

F-string are use to combine strings and variables.

learn more on python program; https://brainly.com/question/14644566?referrer=searchResults

The game world plays a crucial role in bringing the game story to life and often acts as a bridge between what two elements?

A) the game title and resolution
B) characters and their powers
C) internal conflict and external conflict
D) game mechanics and game story

Answers

Answer:

B Is actually the correct answer

Consider the following pseudocode:

Get the Sqrt of 9.
This pseudocode is an example of what?

A
An event that contains a parameter

B
A function that contains an argument

C
An object that contains a parameter

D
A class that contains an argument

Answers

Answer: sorry I couldn’t help but Pseudocode is an artificial and informal language that helps programmers develop algorithms. Pseudocode is a "text-based" detail (algorithmic) design tool. The rules of Pseudocode are reasonably straightforward. All statements showing "dependency" are to be indented. These include while, do, for, if, switch.

Explanation:

At Moore High, 456 students attended the prom. This is 65 more students than
the previous year.
To the nearest percent, what is the percent of increase from last year to this
year?
12%
15%
17%
19%

Answers

Answer:

B-15%

Explanation:

Yes I agree the answer is B 15%

Lesson 3 - Calling All Operators
Exit
37 of 42
Test
Reset
order
75
do
create variable amount ToCoupon
75 +
order
print
"To receive a coupon, you will need to spend $ >
amount ToCoupon
print
Code
Check the customer's order amount. If it is less than $75, determine how much more
needs to be spent to reach $75 and give the customer that information.
< PREV

Answers

Answer:

.m

Explanation:

Consider the following class designed to store weather statistics at a particular date and time:
public class WeatherSnapshot
{
private int tempInFahrenheit;
private int humidity; // value of 56 means 56% humidity
private int dewPoint; // in degrees Fahrenheit
private String date; // stores the date as a String
private int time; // in military time, such as 1430 = 2:30 pm
private boolean cloudy; // true if 25% or more of the sky is covered
// constructor not shown, but it initializes all instance variables
// postcondition: returns temperature
public int getTemp()
{
return tempInFahrenheit;
}
// postcondition: returns date
public String getDate()
{
return date;
}
// postcondition: returns true if precipitation is likely; false otherwise
public boolean precipitationLikely()
{
// implementation not shown
}
// other methods not shown
}
Suppose a WeatherSnapshot object named currentWeather has been correctly instantiated in a client class. Which of the following will correctly call the precipitationLikely method?
A. boolean couldRain = precipitationLikely();
B. boolean couldRain = currentWeather.precipitationLikely();
C. boolean couldRain = currentWeather.precipitationLikely(true);
D. double percentChanceOfRain = precipitationLikely();
E. double percentChanceOfRain = currentWeather.precipitationLikely();

Answers

Answer:

The answer is "Option b".

Explanation:

In this question, It took the boolean parameter, which may use the couldRain as the precipitationLikely precipitation method as the boolean variable because the precipitationLikely is not a static type, and it can name this method utilizing object is called currentWeather, that's why the choice b is correct.

Do you think it’s better for a young designer to use free, open-source art programs or to pay for commercial programs? Explain your answer, but come up with at least one counterargument that forces you to defend your position when you explain why you think one option is better than the other.

Answers

Answer:

I think that if you are starting you should use a free, open-source art program. Because starting up with alot of things like this is hard with no money but the resources that we have could help with that. That's why I think the free one is better than paying, especially monthly pay.

Explanation:

The power relationship on a transformer states that O Power in = power out + loss O Power in = 1/2 power out (Power in = 2 x power out O All of the above None of the above​

Answers

Answer:

D

Explanation:

The power relationship on a transformer states that Power in = power out + loss.

What relationship does input and output power have in a transformer?

The ratio between output voltage and input voltage exists the exact as the ratio of the number of turns between the two windings

The efficiency of a transformer exists reflected in power (wattage) loss between the primary (input) and secondary (output) windings. Then the consequent efficiency of a transformer stands equivalent to the ratio of the power output of the secondary winding, PS to the power input of the primary winding, PP  and exists thus high.

Therefore, the correct answer is option A) Power in = power out + loss.

To learn more about power

https://brainly.com/question/13787582

#SPJ2

Consider the following code segment.
firstList + ["guitar", "drums", "bass"]
secondList + ["flute", "violin"]
thirdList = []
thirdList + firstList
firstList secondList
secondlist thirdList
What are the contents of secondList after the code segment is executed?
А
[]
00
["guitar", "drums", "bass"]
с
["flute", "violin"]
D
["flute", "violin", "guitar", "drums", "bass"]

Answers

Answer:

[tex]secondList = ["guitar", "drums", "bass"][/tex]

Explanation:

At the third line of the code segment:

An empty list thirdList is created

At the fourth line of the code segment:

The content of firstList is passed into thirdList

i.e. [tex]thirdList = ["guitar", "drums", "bass"][/tex]

At the fifth line of the code segment:

The content of secondList is passed into firstList

i.e. [tex]firstList =  ["flute", "violin"][/tex]

At the fifth line of the code segment:

The content of thirdList is passed into secondList

i.e. [tex]secondList = ["guitar", "drums", "bass"][/tex]

Adding a paper clip to the vertical stabilizer of your glider will have what effect on its Center of Gravity (CG)?
The CG would move toward the rear.
The CG would stay the same.
The CG would move toward the nose.
O The CG would move lower

Answers

Answer:

the CG would move toward the rear.

Explanation:

Adding a paper clip to the vertical stabilizer of your glider will, the CG would move toward the rear. The correct option is A.

What is center of gravity?

The place on an item where the force of gravity is thought to act is known as the center of gravity (CG).

The gravitational pull is thought to be focused at the point where an object weighs on average. Depending on the object's size, shape, and mass distribution, the center of gravity will be in one place or another.

The impact of adding a paper clip to your glider's vertical stabilizer is to shift the center of gravity (CG) to the back of the glider.

This is due to the fact that the paper clip adds weight to the glider's rear, moving the center of mass there and, as a result, the center of gravity.

Thus, the correct option is A.

For more details regarding center of gravity, visit:

https://brainly.com/question/20662119

#SPJ6

What is the relationship between a database and an information system and what impact does this relationship have on database design?
Respond to one or both of the following statements:

a. It is impossible to produce good information from poor data.
b. No matter how sophisticated the application programs are, it is impossible to use good application programs to overcome the effects of bad database design.

Answers

Answer:

b

Explanation:

hhiivibibu9 gg8 oh 8h h9 h 0h9

what time is spellrd the same forwards and backwards​

Answers

12:21 is the correct answer

write an algorithm to find the average of six numbers​

Answers

Answer:

Input: two numbers x and y Output: the average of x and y Step 1 : input x,y Step 2: sum=0,average=0 Step 3:sum = x + y Step 4:average = sum /2 Step 5: print average.

Explanation:

Input: two numbers x and y Output: the average of x and y Step 1 : input x,y Step 2: sum=0,average=0 Step 3:sum = x + y Step 4:average = sum /2 Step 5: print average.

Algorithms are set of instructions which are to be followed in other to solve a particular problem. The algorithm which gives the average of six values goes thus:

1.)

Input : a, b, c, d, e, f

#takes input of the six numbers

2.)

sum=0 ; average=0

# initialize sum and average variables to 0

3.)

sum = a + b + c + d + e + f

#takes the sum of the six numbers

4.)

average = sum /6

#divide the sum by the number of values.

5)

print average.

#display the average value

Learn more : https://brainly.com/question/24266817

Any1??
Write the names of atleast 22 high-level programming languages

Answers

Answer:

1 Array languages

2 Assembly languages

3 Authoring languages

4 Constraint programming languages

5 Command line interface languages

6 Compiled languages

7 Concurrent languages

8 Curly-bracket languages

9 Dataflow languages

10 Data-oriented languages

11 Decision table languages

12 Declarative languages

13 Embeddable languages

13.1 In source code

13.1.1 Server side

13.1.2 Client side

13.2 In object code

14 Educational languages

15 Esoteric languages

16 Extension languages

17 Fourth-generation languages

18 Functional languages

18.1 Pure

18.2 Impure

19 Hardware description languages

19.1 HDLs for analog circuit design

19.2 HDLs for digital circuit design

20 Imperative languages

21 Interactive mode languages

22 Interpreted languages

23 Iterative languages

Explanation:

41. Which is NOT a valid statement to initialize a variable?
a. int =100;
b. long population=15000;
C. char n[]="Hello word";
d. const int N=100;

Answers

I think its c I hope I'm not wrong about this If I am I'm sorry

Write a class called Person that has two data members - the person's name and age. It should have an init method that takes two values and uses them to initialize the data members.Write a separate function (not part of the Person class) called std_dev that takes as a parameter a list of Person objects (only one parameter: person_list) and returns the standard deviation of all their ages (the population standard deviation that uses a denominator of N, not the sample standard deviation, which uses a different denominator).

Answers

Answer:

class Person(object):

   def __init__(self, name, age):

       self.name = name

       self.age = age

 

def std_dev(person_list):

   average = 0

   for person in person_list:

       average += person.age

   average /= len(person_list)

   total = 0

   for person in person_list:

       total += (person.age - average) ** 2

   return (total / (len(person_list) )) ** 0.5

Explanation:

The class "Person" is a python program class defined to hold data of a person (name and age). The std_dev function accepts a list of Person class instances as an argument and returns the calculated standard deviation of the population.

Gamification and virtual reality is the future of education . I need a speech on this topic

Answers

Hahaha jsisienenwisjejwje

Conside following prototype of a function
int minArray(int [], int );
Which of the option is correct way of function CALL assuming following arraydeclaration
int x[5] = {7,4,6,2,3};*
a) minArray(x,5);
b) minArray(x[],10);
c) minArray(x[5],5);
d) minArray(5,x);

Answers

Answer:

The answer is "Option a"

Explanation:

Following are the code to this question:

#include <stdio.h>//header file

int minArray(int x[], int n)//defining method minArray that accepts two parameters

{

   for(int i=0;i<n;i++)//defining loop for print value

   {

    printf("%d\n",x[i]);//printf array value

   }

}

int main()//defining main method

{

int x[] ={7,4,6,2,3};//defining array that hold values

int n=5;//defining integer variable

minArray(x,5);//calling method minArray

return 0;

}

In this code, a method "minArray" is defined, that accepts two parameters array and an integer variable in its parameter, and in the next step, the for loop is declared, that uses the print method to prints its value.

In the next step, the main method is declared, which declared an array and holds its values and defines an integer variables, and calls the method "minArray".

Other Questions
help vibe buddy!!!!!!!11 At the height of 800 meters, a skydiver falls from an airplane flying horizontally at 40 m/sec. What is the horizontal distance of the skydivers travel before they "hit" the ground? Cindy goes into the ER with a broken leg, and her doctor orders an X-ray. At the X-ray, Cinis wearing a medical scrub uniform. The X-ray technician places a lead vest on Cindy andleg for the image. The X-ray technician then goes into another room and takes the image.radiographic safety measures that were taken for Cindy and the technician?Cindy was protected by the position of her leg, and the technician was protected by theO Cindy was protected by the technician going in another room, and the technician wasCindy was protected by the lead shield, and the technician was protected by going in aCindy was protected by lying down and the technician was protected by the medical se What is the answer pls help Celina built a model of a triangular pyramid. The model's height is shown in the diagram. If the volume of Celina's model is 96.37 cubic centimeters, what is the area of the triangular base in square centimeters? Round answer to the nearest hundredth.12.85 square centimeters4.28 square centimeters38.55 square centimeters240.925 square centimeters Based on lines 1 through 29 in "Excerpt from Little Cricket," how are Thek's and Grandfather's points of view about living in America different? Use two details front the story to support your response. Choose the correct translation for the underline word in the following Ab amics iuvabimur ________Underline word is iuvabimur Answers We have been helpedWe will be helped We are being helpedWe were being helping This is Latin btw Convert the following repeating decimal into a fraction_0.16 What were two examples of "firsts" by Washington? Solving linear equation study island Which of the following was areason for many to settle out in the West under the Homestead Act?A. the frequent droughts in the New EnglandstatesB. the land was yours at no cost after five yearsC. the invention of the automobileD. the demand for wheat and corn to beproduced *************MUST ANSWER!***************Sebastian has a points card for a movie theater. -He earns 85 points just for signing up.-He earns 2.5 points for each visit to the movie theater.-He needs 115 points for a free movie ticket.Write and solve an Equation which can be used to determine v, the number of visits Sebastian must make to earn a free movie ticket. If we add the second equation to the first equation, we have a newequation: 7c+8p=29.60. Explain why the same (c, p) pair that is a solutionto the two original equations is also a solution to this new equation.Pls help asp this is due in a few hours !!! Part AWhat is a theme of "Harlem [2]"?It is better to be practical than to be a dreamer.Any dream can come true with determination.Putting aside a dream leads to hopelessness.Everyone has equal opportunities in life.Question 2Part BHow does Langston Hughes develop the theme identified in Part A?He explains that some dreams are worth pursuing.He hints that people should work hard toward achieving their dreams.He suggests that people put dreams aside and focus on opportunities.He suggests that some dreams can wear heavily on a person. Romi and Julio have no classes together, but they meet nearly every day Decide if the statement is true or false.7 is a solution of - 4x = -28. ILL MARK AS BRAINLESS PLS HELP Im thinking both what do you all think?? Find the value of the expression whenx=1, y=-1,z =0a)5y y b) 3x +2y + 3z c) 2y -3xyz -3 < 5, add 4 to both sides