If you have downloaded this book's source code from the companion Web site, you will find a file named text.txt in the Chapter 12 folder. (The companion Web site is at www.pearsonhighered/gaddis.) The text that is in the file is stored as on sen- tence per line. Write a program that reads the file's contents and calculates the average of words per sentence.

Answers

Answer 1

Answer:

Explanation:

The following python code loops through each line within a file called text.txt and counts all the words, then it divides this count by the number of sentences in the text file. Finally, output the average number of words per sentence.

f = open("text.txt", "r")

all_words = 0

sentences = 0

for x in f:

   list = x.split(' ')

   all_words += len(list)

   sentences += 1

average = all_words / sentences

print("There are an average of " + str(average.__round__()) + " words in each sentence.")

If You Have Downloaded This Book's Source Code From The Companion Web Site, You Will Find A File Named

Related Questions

Write the simulate method, which simulates the frog attempting to hop in a straight line to a goal from the frog's starting position of 0 within a maximum number of hops. The method returns true if the frog successfully reached the goal within the maximum number of hops; otherwise, the method returns false. TheFrogSimulationclass provides a method calledhopDistancethat returns an integer representing the distance (positive or negative) to be moved when the frog hops. A positive distance represents a move toward the goal. A negative distance represents a move away from the goal. The returned distance may vary from call to call. Each time the frog hops, its position is adjusted by the value returned by a call to thehopDistance method. g

Answers

Answer:

Explanation:

The following code is written in Python. It creates the simulate method which takes in an argument for the max number of hops and the goal distance. Then it loops the number for the max number of hops and asks the user for a hop input using the hopDistance() method (which was not included so it was made, this can be removed if wanted). Then it updates position. If after the max hops goal was reached it returns True, otherwise it returns False.

def simulate(max, goal):

   position = 0

   print("Goal is " + str(goal))

   for x in range(max):

       hop = hopDistance()

       position += int(hop)

   if position >= goal:

       return True

   else:

       return False

def hopDistance():

   return input("Frog Hop Distance this hop: ")

print(simulate(4, 20))

Do exercises as follows:

a. Enter a whole number from keyboard, a while loop should calculate a sum of all numbers from one to that number that you entered
b. Enter a numeric score - grade of a test, your program should print a corresponding letter grade that matches the score.

For example, if you enter 89.3, the program should display "B", and if you enter 95.7, then the program displays "A"

Answers

Answer:

Explanation:

The following Java program asks the user for a number to be entered it and uses a while loop to sum up all the numbers from 1 to that one and print it to the console. Then it asks the user for a grade number and prints out the corresponding letter grade for that number.

file = open('text.txt', 'r')

total_rainfall = 0

for line in file:

   line = line.replace('\n', '')

   info = line.split(' ')

   info = [i for i in info if i != '']

   print(info[0] + " will have a total of " + info[1] + " inches of rainfall.")

   total_rainfall += int(info[1])

average = total_rainfall / 3

print("Average Rainfall will be " + str(average) + " inches")

Using a tag, set the color to green for all tags.

Answers

Answer:

<style>

p {

background-color: rgb(255, 0, 0);

}

h1 {

background-color: rgb(0, 255, 0);

}

ol {

background-color: rgb(97,51,47);

}

</style>

Explanation:

Put this at the top of your code. It should target the paragraph tag, the header h1 tag, and the Ordered List (OL) tag individually and set their background colors respectively.

It's been a while since I've done CSS so you might have to tweak the syntax a bit, but it should look something like that.

how many stages needed to have powerful amplifier?​

Answers

Power amplifier stages in a real circuit. Circuit diagram of a three stage practical audio power amplifier is shown in the figure below. Small signal transistor Q1 and its associated components form the voltage amplification stage.

Answer:

Generally you should pick an amplifier that can deliver power equal to twice the speaker's program/continuous power rating. This means that a speaker with a “nominal impedance” of 8 ohms and a program rating of 350 watts will require an amplifier that can produce 700 watts into an 8 ohm load.

Which of the following is not part of the four ways you can avoid problems with email communication?
a.
Be brief.
b.
Proofread your message.
C.
Reply right away after you get an email.
d.
Seek other ways to relay your message

Answers

Answer:

d is the correct answer for this problem

How SPARQL 1.1 has advantage over SPARQL 1.0??​

Answers

SPARQL 1.0 became an official W3C Recommendation on 15 January 2008. On 26 March 2013, the SPARQL Working Group has produced a new W3C Recommendation SPARQL 1.1 that introduces more features to 2008 version. SPARQL is emerging as the de facto RDF query language. Prior to SPARQL, there were some other popular RDF query languages, such as RQL, SeRQL, TRIPLE, RDQL, and so on. The comprehensive...

Please Fix This For Me


print ("Please enter a number between 1 and 100")
n = input

if = n < 1 and n > 100:

if = (n // 2 == 0):
print (n, "is even")

if = (n // 3 == 0):
print (n, "is odd")

else:
print("You have not entered a number between 1 and 100.")

Answers

Answer:

The correction is as follows:

n = int(input("Please [tex]enter\ a[/tex] [tex]number\ between\ 1[/tex] and 100: "))

if n < 1 or n > 100:

   print("You [tex]have\ not[/tex] entered a [tex]number\ between\ 1[/tex] and 100.")

elif n % 2 == 0:

   print (n, "is even")

else:

   print (n, "is odd")

Explanation:

See attachment for explanation

63. Name the 4 main lights & and their primary purpose.

Answers

I don’t know this !!

You have been given an encrypted copy of the Final exam study guide here, but how do you decrypt and read it???

Along with the encrypted copy, some mysterious person has also given you the following documents:

helloworld.txt -- Maybe this file decrypts to say "Hello world!". Hmmm.

hints.txt -- Seems important.

In a file called pa11.py write a method called decode(inputfile,outputfile). Decode should take two parameters - both of which are strings. The first should be the name of an encoded file (either helloworld.txt or superdupertopsecretstudyguide.txt or yet another file that I might use to test your code). The second should be the name of a file that you will use as an output file. For example:

decode("superDuperTopSecretStudyGuide.txt" , "translatedguide.txt")

Your method should read in the contents of the inputfile and, using the scheme described in the hints.txt file above, decode the hidden message, writing to the outputfile as it goes (or all at once when it is done depending on what you decide to use).

Hint: The penny math lecture is here.

Another hint: Don't forget about while loops...

Mac hint: use encoding="utf-8" in your file open functions, like this:

Mac hint: use encoding="ascii" in your file open functions, like this:

fin = open(input_file,"r",encoding="ascii")

Answers

Answer:

You use a decoder

Explanation:

You can find one on an internet browser

When the function below is called with 1 dependent and $400 as grossPay, what value is returned?

double computeWithholding (int dependents, double grossPay)

{
double withheldAmount;
if (dependents > 2)
withheldAmount = 0.15;
else if (dependents == 2)
withheldAmount = 0.18;
else if (dependnets == 1)
withheldAmount = 0.2;
else // no dependents
withheldAmount = 0.28;
withheldAmount = grossPay * withheldAmount;
return (withheldAmount);
}

a. 60.0
b. 80.0
c. 720.0
d. None of these

Answers

Answer:

b. 80.0

Explanation:

Given

[tex]dependent = 1[/tex]

[tex]grossPay = \$400[/tex]

Required

Determine the returned value

The following condition is true for: dependent = 1

else if (dependnets == 1)

withheldAmount = 0.2;

The returned value is calculated as:

[tex]withheldAmount = grossPay * withheldAmount;[/tex]

This gives:

[tex]withheldAmount = 400 * 0.2[/tex]

[tex]withheldAmount = 80.0[/tex]

Hence, the returned value is 80.0

Hubs connect network hosts in which configuration?

Answers

Answer:

A high availability hub is not required to enable or use the self-describing agent. You can optionally configure a high availability hub for improved availability and recovery if the hub fails. Network Layer – The network layer is responsible for creating a routing table, and based on the routing table, forwarding the input request. Some of the Devices used in the Network Layer are, Routers: A router is a switch-like device that routes/forwards data packets based on their IP addresses.

Explanation:

(hope this helps can i plz have brainlist :D hehe)

Let's make a song, continue from these lines

My heart is dead
My mind is in a loop

Answers

My head hurts

Underpressure

Explanation:

a trance that I cant stop

what is the full from of CPU?​

Answers

Answer:

CPU is known as Central Processing Unit.

Full form? Like CPU meaning central processing unit?

Create a class called StockTester that has the following fucntionality. a. Create a main method with an ArrayList named dataStock that stores objects of type Stock. b. Add code that reads the content of StockInfo.csv and places it in dataStock. c. Create a new Stock object named newStock using the constructor in Question 1. Set the values to the following. Stock name: Gamma, Stock purchase date: 03/01/20, Number of Shares of Stock: 100, Stock Price: 50.5. Add newStock to dataStock. d. Print the information associated with newStock using printStock. e. Using the method requiredReturn, determine the rate of return required for your stock in Pitsco to have a value of $4,000 in 3 years. Print the result to the screen so that the user can clearly read the result.

Answers

Solution :

public class [tex]$\text{Stock}$[/tex] {

private [tex]$\text{String}$[/tex] stockName, [tex]$\text{purchaseDate}$[/tex];

private [tex]$\text{int}$[/tex] nShares;

private [tex]$\text{double}$[/tex] price;

 

public [tex]$\text{Stock}()$[/tex]

{

this.stockName = "";

this.purchaseDate = "";

this.nShares = 0;

this.price = 0.0;

}

public Stock(String stockName, String purchaseDate, int nShares, double price) {

this.stockName = stockName;

this.purchaseDate = purchaseDate;

this.nShares = nShares;

this.price = price;

}

public String getStockName() {

return stockName;

}

public void setStockName(String stockName) {

this.stockName = stockName;

}

public String getPurchaseDate() {

return purchaseDate;

}

public void setPurchaseDate(String purchaseDate) {

this.purchaseDate = purchaseDate;

}

public int getnShares() {

return nShares;

}

public void setnShares(int nShares) {

this.nShares = nShares;

}

public double getPrice() {

return price;

}

public void setPrice(double price) {

this.price = price;

}

 

public String toString()

{

return("Stock name: " + this.stockName + "\nPurchase date: " + this.purchaseDate

+ "\nNumber of shares of stock: " + this.nShares + "\nPrice: $" + String.format("%,.2f", this.price));

}

 

public void printStock()

{

System.out.println("Stock name: " + this.stockName + "\nPurchase date: " + this.purchaseDate

+ "\nNumber of shares of stock: " + this.nShares + "\nPrice: $" + String.format("%,.2f", this.price)

+ "\n");

}

}

StockTester.java (Driver class)

import [tex]$\text{java.io.}$[/tex]File;

import [tex]$\text{java.io.}$[/tex]File[tex]$\text{NotFound}$[/tex]Exception;

import [tex]$\text{java.util.}$[/tex]ArrayList;

import [tex]$\text{java.util.}$[/tex]Scanner;

[tex]$\text{public}$[/tex] class StockTester {

 

private static final String FILENAME = "StockInfo[tex]$.$[/tex]csv";

 

public static [tex]$\text{void}$[/tex] main([tex]$\text{String}[]$[/tex] args)

{

ArrayList[tex]$<\text{stock}>$[/tex] dataStock = [tex]$\text{readData}$[/tex](FILENAME);

 

System.out.println("Initial stocks:");

for(Stock s : dataStock)

s.printStock();

 

System.out.println("Adding a new Stock object to the list..");

Stock newStock = new Stock("Gamma", "03/01/20", 100, 50.5);

dataStock.add(newStock);

 

System.out.println("\nStocks after adding the new Stock..");

for(Stock s : dataStock)

s.printStock();

 

Stock targetStock = dataStock.get(3);

double reqReturn = requiredReturn(targetStock, 4000, 3);

System.out.println("Required rate of return = " + String.format("%.2f", reqReturn) + "%");

}

 

private static ArrayList<Stock> readData(String filename)

{

ArrayList<Stock> stocks = new ArrayList<>();

Scanner fileReader;

try

{

fileReader = new Scanner(new File(filename));

while(fileReader.hasNextLine())

{

String[] data = fileReader.nextLine().trim().split(",");

String stockName = data[0];

String purchaseDate = data[1];

int nShares = Integer.parseInt(data[2]);

double price = Double.parseDouble(data[3]);

 

stocks.add(new [tex]$\text{Stock}$[/tex](stockName, [tex]$\text{purcahseDate}$[/tex], nShares, price));

}

fileReader.close();

}catch(FileNotFoundException fnfe){

System.out.println(filename + " cannot be found!");

System.exit(0);

}

return stocks;

}

 

private static double requiredReturn(Stock s, double targetPrice, int years)

{

double reqReturn;

 

double initialPrice = s.getPrice() * s.getnShares();

reqReturn = ((targetPrice - initialPrice) / initialPrice * years) * 100;

 

return reqReturn;

}

}

Suppose a program is supposed to reverse an array. For example, if we have the array arr = {1, 2, 3, 4, 5}, after reversing the array we would have arr = {5, 4, 3, 2, 1}.

Most of the code for the program is shown here:
Const int SIZE = 5;
int arr[SIZE] = {1, 2, 3, 4, 5};
int firstindex =0, lastindex = SIZE-1, temp;

1 _______________________________

{
temp = arr[firstindex];
arr[firstindex] = arr[lastindex];
arr[lastindex] = temp;
firstindex++;
lastindex--;
}

All of the following options below could be correctly inserted at line 1 in the code shown above EXCEPT:

a. while(firstindex < lastindex)
b. while(firstindex <= lastindex)
c. for(int i=0; i<(SIZE/2-1); i++)
d. for(int i=0; i<(SIZE/2); i++)

Answers

Answer:

The answer is "Choice C".

Explanation:

In this question, the choice C is correct because all the other options will the output "5 4 3 2 1" and it will given "5 2 3 4 1" as output which is defined in the attached file. please find it.

9.19 LAB: Words in a range (lists) Write a program that first reads in the name of an input file, followed by two strings representing the lower and upper bounds of a search range. The file should be read using the file.readlines() method. The input file contains a list of alphabetical, ten-letter strings, each on a separate line. Your program should output all strings from the list that are within that range (inclusive of the bounds). Ex: If the input is:

Answers

Answer:

9.2. Métodos del Objeto File (Python para principiantes)

Explanation:

NO LINKS
write a shell script to find the sum of all integers between 100 and 200 which are divisible by 9​

Answers

Answer:

#!/usr/bin/env bash

for num in {100..200}

do

   if [ $((num % 9)) -eq 0 ]

   then

       ((sum += num))

   fi

done

echo $sum

Explanation:

The output will be 1683.

Which element adjusts the space around the data in each cell of a table? adjusts the space around the data in each cell of a table.

Answers

Answer:

Increase/decrease indentation

Explanation:

Answer:

(Cellpadding) is actually the correct answer.

Explanation:

Cellpadding and cellspacing are two important features of an HTML table. Cellpadding sets the space around the data in each cell. Cellspacing sets the space around each cell in the table.

3) Many people use the World Wide Web (Web) regularly, and search engines
provide vital access to Web resources. Textual and multimedia content is
accessible via web search engines. Informational, navigational, and
transactional intent are the three types of user intent classified for Web
searching. What is meant by navigational, informational, and transactional
search? Provide a comprehensive explanation with examples for each.

Answers

Answer: See explanation

Explanation:

Navigational search - This occurs when the user is looking for a certain website. Then the name of the website will be entered into the search bar.

Informational search - This occurs when the user wants to get a certain information. For example, if user enters "what is computer" into the search bar, different results relating to the word "computer" will be gotten.

Transactional search - This occurs when the user wants a website that is interactive it which possess more interaction. An example is when the user wants to buying something, register for something or maybe download something

A video game controller contains the buttons: A, B, X, Y. When the player presses A their character Jumps. When the player presses BY their character Crouches. When the player presses X their character Punches. When the player presses Y their character Flies. When the player presses anything else Pause menu shows up Assume your program contains a variable named button that holds a character which indicates the button the player has pressed. Write the switch statement that displays a message explained the user the action that was taken.

Answers

Answer:

Explanation:

The following switch statement takes in the variable button as a parameter and outputs a statement saying what the character did due to the button being pushed.

switch (Character.toLowerCase(button.charAt(0))) {

           case 'a': System.out.println("Your character has Jumped"); break;

           case 'b': System.out.println("Your character has Crouched"); break;

           case 'x': System.out.println("Your character has Punched"); break;

           case 'y': System.out.println("Your character has Flown"); break;

           default: System.out.println("Pause Menu has appeared"); break;

       }

True or false you cannot get a computer virus is you instal antivirus

Answers

Answer: F

Explanation: There are many ways hackers can get into your computer, and many ways can bypass an antivirus so it is False

This is true because if you instal antivirus is no way the computer get virus then

Earth, Wind & Fire were NOT known for combining many different styles of music together.Required to answer. Single choice.
(1 Point)

True

False

Answers

Answer:

false

Explanation:

Cause I don't believe you can't use earth, wind,and fire to create music.

What is one advantage of using the Option Group Control for data validation? It works best with fields that use the date data type. It alerts the user when the database is about to close. It applies to numeric fields only, eliminating text errors. The data entry is restricted to specific fields, reducing errors.

Answers

Answer:

The Data Entry is Restricted to Specific Fields, Reducing Errors

Explanation:

Answer:

D

Explanation:

edge2021

what can a user modify on a business card using the Edit Business card in the dialog box?​

Answers

Answer: layout,image,font,background color,

Consider the following method:
public static String joinTogether(int num, String[] arr)
{
String result = "";
for (String x : arr)
{
result = result + x.substring(0, num);
}
return result;
}

The following code appears in another method in the same class:
String[] words = {"dragon", "chicken", "gorilla"};
int number = 4;
System.out.println(joinTogether(number, words));

What is printed when the code above is executed?
a. dragonchickengorilla
b. drachigor
c. dragchicgori
d. dragochickgoril
e. There is an error in the program, it does not run

Answers

Answer: b.

Explanation:

5. A restore program generally is included with what type of utility?
O A. Screen saver
O B. Antivirus
O C. Uninstaller
D. Backup

6. The interface that allows interaction with menus, and visual images such as
buttons:
A. Touchscreen user interface
O B. Menu driven Interface
O C. Graphical user interface
O D. Command line interface​

Answers

The answer is B because the rest of them doesn’t make scenes

Ralph and his team need to work together on a project. If they need a device that will provide shared storage with access to all team members, which of these devices would work best? *

USB Flash Drive
2 TB HDD installed on one of their computers
BD-RW installed on one of their computers
Network attached storage appliance

Answers

You will need a network attached storage appliance

When identifying who will send a presentation, what are the two types of audiences?

Answers

Answer:

Explanation:Demographic audience analysis focuses on group memberships of audience members. Another element of audience is psychographic information, which focuses on audience attitudes, beliefs, and values. Situational analysis of the occasion, physical setting, and other factors are also critical to effective audience analysis.

ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP​

Answers

Answer:

13.c

14.d

15.b

16.a

17.c

Explanation:

please brainleist please ☺️♨️

Write a class called MonetaryCoin that is derived from the Coin class presented in Chapter 5 (the source code for Chapter 5 examples is available via Moodle). [6 pts] Store one integer and one float in the MonetaryCoin that represent its value and weight in grams, respectively. Add a third variable of your choice (related to a coin, of course) and use self-descriptive variable names for all three variables. Pass the values to the constructor in MonetaryCoin and save them to your variables.

Answers

Answer:

Explanation:

The following Java code creates the MonetaryCoin class that extends the Coin class. It then creates three variables representing the MonetaryCoin object which are its value, weight, and coinYear. These are all passed as arguments to the constructor and saved as instance variables.

public class MonetaryCoin extends Coin {

   

   int value;

   float weight;

   int coinYear;

   

   public void MonetaryCoin(int value, float weight, int coinYear) {

       this.value = value;

       this.weight = weight;

       this.coinYear = coinYear;

   }

}

Other Questions
Someone please help me on this question please. Dont put a link. Please help me. Choose the graph with a slope of 1/2 Before the industrial revolution was trade between villages a common practice? Organizational buyers, when compared to buyers of consumer goods, are........ in number, geographically............. and ............. apt to buy on specifications.A. Fewer,dispersed,lessB. Fewer, concentrated, lessC.Fewer, concentrated,moreD. Greater, concentrated,lessE. Greater,dispersed,more Question 12 of 20Quin hace los planes para construir un edificio?A. El abogadoB. El mdicoC. El camareroD. El ingenieroSUBMIT Could someone help, please? The square of a number decreased by ten times the number is negative nine. A triangle has one side that is 31 inches long and a second side that is 44 inches long. The least possible length of the third side is_____ in. The greatest possible length of the third side is____in. (Please write the answer in whole numbers only)BRAINLIEST!!!!!!! Abduls average speed is 40 mph in heavy traffic and his average speed is 50 mph in light traffic if he was in heavy traffic 1 hour and light traffic for 3 hours how far did Abdul travelA. 90B. 270C. 190D. 55 How many atoms are in 14 moles of I? Watch your significant figures.A. 8.4 x 10^24 atoms of lB. 8.43 x 10^24 moles of lC. 8.4 x 10^23 atoms of ID. 8.43 atoms of l Which of the following correctly identifies a relatively recent change in firstaid care?O A. In emergencies related to drugs or poisons, encouraging thepatient to vomit is not recommended.B. In emergencies related to burns, the use of ice and ointments isnot recommended.C. In emergencies related to seizures, trying to stop the seizure is notrecommended.D. In emergencies related to heart attacks, the ingestion of aspirin isnot recommended.SUBMIT A student is looking for evidence that spindle fibers are separatingchromosomes during cell division. Which cell is the student looking forbelow?* the saint lawrence river area was?A: BusyB: DeadC: Slowly Growing 11. Albert has 12 more 10 cent coins than 20-centcoins. The total value of all his coins is $5.40. Findthe total number of coins he has. ________________ mortgage is two or more mortgages consolidated into one payment, and is usually designed to allow the buyer to purchase with a smaller down payment, with the added benefit of a below market interest rate first mortgage. The sellers receive all of their cash at the time of closing, while the lender wraps new money around an existing assumable loan. This type of loan limits its use to homes with an existing FHA or VA loans because most other conventional loans have alienation or due on sale clauses. questions abt the SAT I wanna be prepared. pls, help. how can I prepare for the SAT math and other test subjects? how many times can I take it? how early can and should I take it? how important is the SAT? is there anything specific I should know about the SATim 15 in 10th grade btw are you chemistry because you just blew up my heart Which system includes all life on Earth?A biosphereB cryosphereC geosphereD hydrosphere Which line shows that manuel's feelings have changed since early stanzas who wakes up lysander?