Create and Provide complete program that includes a comments header with your name, course, section and other program details and does the following: 1) prompt the user to provide a side of square 2) get side from the user and store it into variable 3) based on the side value calculate perimeter of the square 4) calculate area of the square 5) calculate diameter of the square The program should provide the following output: Enter the side of a square: 12 The perimeter is 48.0 The area is 144.0 The length of the diagonal is 16.97056274847714

Answers

Answer 1

Answer:

Written using C++

/*Enter Your Details Here*/

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

//1

float side;

cout<<"Enter the side of a square: ";

//2

cin>>side;

//3

float perimeter = 4 * side;

cout<<"The perimeter is "<<perimeter<<endl;

//4

float area = side *side;

cout<<"The area is "<<area<<endl;

//5

float diagonal = sqrt(2 * side * side);

cout<<"The length of the diagonal is "<<diagonal;

return 0;

}

Explanation:

I've added the full source code as an attachment where I used more comments to explain difficult line


Related Questions

Major stress in your life can cause:
O a. headaches and Insomnia
O b. Fatigue and dry mouth
O c. Muscular and abdominal pain
O d. All of the above

Answers

A IS THE ANSWER HOPE IT HELPS !! :)
answer- (d.) All of the above
explanation- Chronic stress can disrupt every system in your body. For example, your immune system, reproductive system, and can increase the risk of a heart attack.

1. What is wrong with the following code?
#include
#include
int *get_val(int y) {
int x = 200;
x += y;
return &x;
}
int main() {
int *p, y = 10;
p = get_val(y);
printf("%d\n", *p);
exit(0);
}

Answers

Answer:

Aye dog I don't know nothing about code, yes its true, but I hope that you get an answer for you!

Explanation:

Facts...

The is context sensitive, meaning it will display options that relate to an active tool.

Answers

Answer:

Option bar

Explanation:

The Options Bar seems to be the parallel bar in photo editing software that operates under it's main menu. You will use the Software panel to turn it on and off, but if you're not seeing it on your phone, you probably want Software > Settings to power it on. The role of the Options Bar is to customize the tool settings when you're about to use.

Answer:

(A) The ribbon

Explanation:

Write a program to read in two consumer price indexes and print out the inflation rate.
1. Start with the student starter code and follow the instructions in the code.
2. Instructions to complete are tagged in comments like the ones below. They will always begin with // TODO. // TODO #1: declare two float variables for the old consumer price index (cpi) and the new cpi // TODO #2: Read in two float values for the cpi and store them in the variables
// TODO #3: call the function InflationRate with the two cpis // TODO #4: print the results
3. Once you have this program working, submit for credit.
4. Advance to the next lab InflationRate Part2.

Answers

Answer:

Here is the C++ program:

#include<iostream>  //to use input output functions

#include<cmath>  //to use math functions

using namespace std;  //to identify objects cin cout

double InflationRate(float oldCPI,float newCPI);  //function prototype

int main() {  //start of main function

  float oldCPI,newCPI,rate;  //declares two float variables for the old and consumer price indices

  char choice;  //stores user choice to continue

  double sum=0.0;  // computes the sum of inflation rates

  int count = 0;  //to count the number of inflation rates computed

  double average = 0.0;  //to compute the average inflation rate

  do   {  //this loop continues to execute and ask user to enter cpis

  cout << "Enter the old and new consumer price indices: ";  //prompts user to enter new and old cpi

  cin>>oldCPI>>newCPI;  // Read in two float values for the cpi

  rate = InflationRate(oldCPI,newCPI);  //call the function InflationRate with the two cpis

  cout << "Inflation rate is: "<< rate<< endl;  //displays the result

  sum = sum + rate;  //computes sum of inflation rates

  count++;  //counts number of computed inflation rates

  cout<<"Try again? (Y or y): ";  //prompts if user wants to continue

  cin>>choice;  //reads choice of user y or Y

  }while((choice=='Y')||(choice=='y'));  //the loop continues to repeat as long as user enters small or capital y

  average = sum/count;  //computes the average inflation rate

  cout<<"Average rate is: "<<average;}  //displays the average inflation rate

   

double InflationRate(float oldCPI,float newCPI){  // function that takes two arguments oldCPI and new CPI and computes the inflation rate

   return (newCPI - oldCPI) / oldCPI * 100;} //formula to compute inflation rate

Explanation:

1.        

/*This program computes the inflation rate using two consumer price indexes. It takes as parameters, the previous price index and current price index and computes inflation rate by the formula:

(newCPI- oldCPI) / oldCPI and multiply the result by 100 */

#include <iostream>  //to use input output functions

using namespace std;   //to identify objects cin cout

2.

float oldCPI, newCPI; //declare two float variables for old and new consumer price index

cout << "Enter the old and new consumer price indices: ";  //prompts user to enter values for old and new cpi

cin>>oldCPI>>newCPI; //read in two float values for the cpi and store them in the variables oldCPI and newCPI

double result = InflationRate(oldCPI,newCPI); //call the function InflationRate with the two cpis

cout << "Inflation rate is:  " << result<< endl; //prints the result

3. and 4.

The complete program is given in the Answer section

For example if user enters 238.343 as old cpi and 238.250 as new cpi then the program works as follows:

oldCPI =238.343

newCPI = 238.250

Now the function InflationRate is called by passing these two parameter and this function returns :

   return (newCPI - oldCPI) / oldCPI * 100;}

this becomes

(newCPI - oldCPI) / oldCPI * 100

(238.250 - 238.343) / 238.343  * 100

-0.093/238.343  * 100

- 0.00039 * 100

= -0.039 0204

Hence

result = -0.039 0204

Next, sum = sum + rate; statement computes the sum as:

sum = 0.0 + (-0.039 0204)

sum = -0.039 0204

count++ increases the count by 1

count = 1

Next user is asked if he/she wants to continues. If user presses y or Y then user is asked again to enter values for new and old cpi. Suppose user enters the following values:  

oldCPI =238.250

newCPI = 237.852

Now the function InflationRate is called by passing these two parameter and this function returns :

   return (237.852- 238.250) / 238.250* 100;}

this becomes

(newCPI - oldCPI) / oldCPI * 100

(237.852- 238.250) / 238.250* 100

−0.398/238.250* 100

- 0.001670491 * 100

= -0.167049

Hence

result = -0.167049

Next, sum = sum + rate; statement computes the sum as:

sum =  -0.039 0204 + (-0.167049)

sum = -0.206069

count++ increases the count by 1

count = 2

Now lets say the user enters n or any other key when asked if user wants to continue. So the loop breaks and program moves to the statement:

average = sum/count;

This becomes:

average = -0.206069/2

average = −0.103034

Hence

Average rate is: −0.103034

Which rules should be remembered when creating formulas using nested functions? Check all that apply.
Use an equal sign at the beginning of the formula.
Use open and close parenthesis for each set of nested functions. o
Use an equal sign before each function. All arguments should be in CAPS. Functions should be in CAPS.
Separate functions with commas.​

Answers

Answer:

Use an equal sign at the beginning of the formula (A)

Use open and close parenthesis for each set of nested functions (B)

Functions should be in CAPS (E)

Separate functions with commas (F)

Explanation:

Got it right on edj :)

#include using namespace std;class RunnerInfo { public: void SetTime(int timeRunSecs); // Time run in seconds void SetDist(double distRunMiles); // Distance run in miles double GetSpeedMph(); // Speed in miles/hour __(A)__ int timeRun; double distRun;};void __(B)__::SetTime(int timeRunSecs) { timeRun = timeRunSecs; // timeRun refers to data member}void __(C)__SetDist(double distRunMiles) { distRun = distRunMiles;}double RunnerInfo::GetSpeedMph() const { return distRun / (timeRun / 3600.0); // miles / (secs / (hrs / 3600 secs))}int main() { RunnerInfo runner1; // User-created object of class type RunnerInfo RunnerInfo runner2; // A second object runner1.SetTime(360); runner1.SetDist(1.2); runner2.SetTime(200); runner2.SetDist(0.5); cout << "Runner1's speed in MPH: " << runner1.__(D)__ << endl; cout << "Runner2's speed in MPH: " << __(E)__ << endl; return 0;}Complete the missing parts of the figure above.(b) -> Ru?(c) -> Ru?::(d) -> Get?()(e) -> runner2.?

Answers

Answer:

Here is the complete program:

#include <iostream>

using namespace std;  

class RunnerInfo {

  public:                                

     void SetTime(int timeRunSecs);       // Time run in seconds

     void SetDist(double distRunMiles);   // Distance run in miles

     double GetSpeedMph();                // Speed in miles/hour

   private:

     int timeRun;

     double distRun;  };    

void RunnerInfo::SetTime(int timeRunSecs) {

  timeRun = timeRunSecs;  // timeRun refers to data member

}  

void RunnerInfo::SetDist(double distRunMiles) {

  distRun = distRunMiles; }

double RunnerInfo::GetSpeedMph()  {

  return distRun / (timeRun / 3600.0); // miles / (secs / (hrs / 3600 secs))  }

int main() {

  RunnerInfo runner1; // User-created object of class type RunnerInfo

  RunnerInfo runner2; // A second object

  runner1.SetTime(360);

  runner1.SetDist(1.2);

  runner2.SetTime(200);

  runner2.SetDist(0.5);

  cout << "Runner1's speed in MPH: " << runner1.GetSpeedMph() << endl;

  cout << "Runner2's speed in MPH: " << runner2.GetSpeedMph() << endl;  

  return 0;  }

Explanation:

(A):

private:

The variables timeRun and distRun are the data members of class RunnerInfo so they should be set to be private in order to prevent access from outside the class. So they are set to private which is an access specifier.

(B):

RunnerInfo  

Here the name of the class RunnerInfo is used with double colon operator (::) which is used to qualify a C++ member function. This is used to define a function outside a class. So here the function name is SetTime() and it is defined outside class RunnerInfo. So we use resolution operator to define this function. The basic syntax is:

class_name :: function_name (args)

(C):

RunnerInfo::

This is missing in the above code. This works the same as (B).

:: double colons are called resolution operator :: and it is used  to define a function outside a class.

(D):

GetSpeedMph()

runner1 is the object of class RunnerInfo which represents Runner 1. So in order to display the Runner 1's speed in Mph, the method GetSpeedMph() is called using the object runner1. The object is basically used to access the method of class RunnerInfo. This method GetSpeedMph() computes the speed using formula distRun / (timeRun / 3600.0);  and returns the computed speed in MPH.

(E):

 runner2.GetSpeedMph()

If we see the print statement:

Runner2's speed in MPH:

This shows that the speed of 2nd Runner is required. So for this purpose, the object runner2 is used. So using this object we can call the method that computes the speed of the 2nd runner. This method is GetSpeedMph(). So using runner2 for 2nd runner we access the method GetSpeedMph() to compute the Runner2's speed in MPH.

The entire program after correction gives the following result:

Runner1's speed in MPH: 12                                                                                                                    Runner2's speed in MPH: 9

Which term is not related with font?

Question 5 options:

Font grammar


Font color


Font size


Font face

Answers

Answer:

Font Grammar

Explanation:

Thank Google, lol!

The term that is not related to the font is font grammar. There is nothing such thing as font grammar. The correct option is a.

What are fonts?

Fonts are the shape and design for the different alphabetic. These are present in computers and phones. We can create multiple designs shaped by these fonts.

Web designers could choose a common typeface (like Sans serif) if they want everyone to view the same font because not all machines can display all fonts.

Some designers may opt to use a fancier typeface and then specify a more straightforward font as a "backup" that a computer can use if the fancier font cannot be seen. The theme is a predetermined collection of hues, fonts, and visual effects.

Therefore, the correct option is a, Font grammar.

To learn more about fonts, refer to the link:

https://brainly.com/question/10878884

#SPJ2

Write a single if-test using Boolean operators and relaional operators to determine if a double variable x is between zero (exclusive) and one (inclusive). Print a message indicating that x is between zero and one inclusive. Use deMorgan’s law to show the complement of the previous if-test. Simplify the complement statement so there is no "!" in your final if-test statement. 5. In the following questions, assume Boolean values have been assigned to A, B, and C as follows: boolean AA = true; boolean BB = false; boolean CC = true; Indicate what is printed by each statement: System.out.println( ((AA && BB) || (AA && CC)) ); System.out.println( ((AA || !BB) && (!AA || CC) ); 6. Write a program to determine if an input integer is an even number or odd number. 7. How can the effect of the following program fragment best be described? if (x > y) z = x; if (x == y) z = 0; if (x < y) z = y; a. The smaller of x and y is stored in z. b. The larger of x and y is stored in z. c. The larger of x and y is stored in z, unless x and y are equal, in which case z is assigned 0. d. The larger of x and y is stored in z, unless x and y are not equal, in which case z is assigned 0. e. None of the above.

Answers

Answer:

The following are the solution to this question:

Explanation:

In the given question multiple questions have been asked about, that is defined as follows:

#include<iostream>//defining header file

using namespace std;

int  main()//defining main method

{

  double x1;//defining double variable

  cout<<"enter value: ";//print message

  cin>>x1;//input value from the user-end

  if(x1>0 && x1<=1)//use boolean operators

  {

      cout<<"x is between zero and one";//print message

  }

  return 0;

}

Output:

enter value: 1

x is between zero and one

5)

public class Main//defining a class main

{

public static void main(String[] args) //defining main method

{

       boolean AA = true; //defining boolean variable  

       boolean BB = false;//defining boolean variable  

       boolean CC = true; //defining boolean variable

      if ((AA && BB) || (AA && CC)) //defining if block to check value

      {

         System.out.println("True");//print message

      }

      if ((AA || !BB) && (!AA || CC))//defining if block to check value

      {

         System.out.println("True");//print message

      }

   }

}

Output:

True

True

6)

#include <stdio.h>//defining header file

int main()//defining main method

{

   int x;

   printf("Enter a value: ");

   scanf("%d", &x);

   if (x%2==0)// check number

      {

       printf("Even number");//print message

      }

      else

      {

       printf("Odd Number");//print message

      }

   return 0;

}

Output:

Enter a value: 22

Even number

7)

The answer is "Option C".

In the first question, a double variable "x1"  is defined that inputs the value from the user end and use the boolean operators to check the value and print its value.

In question 5, three boolean variables "AA, BB, and CC" are defined that hold boolean value and use if block to check the given value.

In question 6, an integer variable has defined, that input the value and use if block to check even or odd number and print its value.

In question 7, option c is correct.

Consider two different implementations of the same instruction set architecture. The instructions can be divided into four classes according to their CPI (class A, B, C and D). P1 with a clock rate of 3GHz and CPIs of 3, 2, 1, 4, and P2 with a clock rate of 2.5GHz and CPIs of 2, 2, 2, 2.Processor Class A Class B Class C Class DP1 3 2 1 4P2 2 2 2 2Given a program with a dynamic instruction count of 1.0E5 instructions divided into classes as follows: 10% class A, 30% class B, 40% class C, and 20% class D.1. Which implementation is faster?2. What is the global CPI for each implementation?3. Find the clock cycles required in both cases?

Answers

Answer:

Follows are the solution to this question:

Explanation:

The architecture of two separate iterations with the same the instruction set can be defined in the attached file please find it.

Calculating the value of total instruction count:

[tex]= 1 \times 10^{5} \\\\= 10^5[/tex]

[tex]\text{P1 clock rate} = 3 \ GHz \\ \\\text{P2 clock rate} = 2.5 \ GHz \\\\\text{Class Division: 10 \% of class A,} \text{30 \% of class B, 40 \% of class C, 20 \% of class D} \\\\[/tex]

In point a:

Calculating P1 device mean CPI:

[tex]Average CPI = \frac{summation \times instruction \ count \times CPI}{total \ instruction \ count}\\[/tex]

[tex]= (10^5 \times 10 \% \times 3 + 10^5 \times 30 \% \times 2 + 10^5 \times 40 \% \times 2 + 10^5 \times 20%[/tex] [tex]\times 4) \times \frac{1} {1 \times 10^5}\\\\[/tex]

[tex]= \frac{(3 \times 10^4 + 6 \times 10^4 + 8 \times 10^4 + 8 \times 10^4)}{1 \times 10^5}\\\\ = \frac{25\times 10^4}{1 \times 10^5}\\\\= 2.5[/tex]

Estimating P2 device Average CPI:

[tex]= (1 \times 10^5 \times 10 \% \times2 + 1 \times 10^5 \times 30 \% \times 2 + 1 \times 10^5 \times 40 \% \times 2 + 1 \times 10^5 \times 20 \%[/tex][tex]\times 2) \times \frac{1}{ 1 \times 10^5}[/tex]

[tex]= \frac{(2 \times 10^4 + 6 \times 10^4 + 8 \times 10^4 + 4 \times 10^4)}{1 \times 10^5} \\\\= \frac{20 \times 10^4}{1 \times 10^5} \\\\= 2 \\[/tex]

[tex]\text{Execution time} = \frac{\text{instruction count} \times \text{average CPI}}{clock rate}}[/tex]

[tex]= \frac{1 \times 10^5 \times 2.5}{3} \ GHz \\\\ = \frac{1 \times 10^5 \times 2.5}{3 \times 10^9} \ sec \ as \ 1 \ GHz \\\\ = 10^9 \ Hz \\\\= 0.083 \ msec \ as \ 1 \ sec \\\\ = 10^3 \ msec[/tex]

Calculating processor execution time P2:

[tex]= \frac{1 \times 10^5 \times 2}{2.5} \ GHz \\\\= \frac{1 \times 10^5 \times 2}{2.5 \times 10^9} \ sec \ as\ 1 \ GHz \ = 10^9 \ Hz \\\\ = 0.080 \ msec \ as \ 1 \ sec \\\\ = 10^3 \ msec[/tex]

Since P2 is less than P1 for processor execution time, P2 is therefore faster than P1.

In point b:

Global processor P1 CPI = 2.5  

Global processor P2 CPI = 2

In point c:

Finding Processor P1 clock cycles:

[tex]\text{Clock cycle = instruction count} \times \text{average CPI}[/tex]

[tex]= 1 \times 10^5 \times 2.5 \\\\ = 2.5 \times 10^5 \ cycles[/tex]

Finding Processor P2 clock cycles:

[tex]\text{Clock cycle = instruction count} \times \text{average CPI} \\\\[/tex]

                  [tex]= 1 \times 10^{5} \times 2\\\\ = 2 \times 10^{5} \ cycles\\\\[/tex]

You can run a macro by:
-Selecting the button assigned
-Using the shortcut keys assigned
-Using the view tab
-Selecting run macro from the status bar

Answers

Selecting the button assigned

Using the shortcut Keys assigned

Explanation:

By clicking the assigned button one can run a macro and we can assign a short cut key to macro which we created.

So, the two options we can use to run a macro.

In Outlook 2016, what are the three format options when sending an email message? Check all that apply.

bold
quick style
plain text
rich text
HTML
basic text

Answers

Plain text, HTML, and rich text.

Answer:

C: plain text

D: rich text

E: HTML

List five differences a wiki has to a blog

Answers

Answer:

Blog :

Blogs are built to attract attention of business or product. Content written in the blog are more responsive.Blogs content tend to be more casual and approachable.Blogs contains single self-contained articles.Blogs doesn't require continuous updating and maintenance.Blogs belong to one department in a business.  

Wiki:

Wiki is generally intended for internal use and doesn't benefit from the content.Wiki content is Straightforward ,informative and more formal.A useful wiki is encyclopedic on the topics it contains Wiki requires continuous updating and maintenance to individual pages after publishing.Wiki is handled by all the collaborators who contribute.

Catherine took her camera to the repair shop. The technician at the shop told her that acid had leaked into her camera. What could be the possible reason for acid leaking into Catherine’s camera?

A. She used the camera even though the battery was almost empty.
B. She wiped the camera lens with a moist cloth.
C. She left the camera in harsh daylight.
D. She left fully discharged batteries in her camera.

Answers

Answer:

B

Explanation:

Consider the following method.
public double secret(int x, double y) { return x/2.0; }
Which of the following lines of code, if located in a method in the same class as secret, will compile without
error?
int result = secret(4, 4);
double result = secret(4.0, 4);
int result = secret(4, 4.0);
double result = secret(4.0, 4.0);
double result = secret(4, 4.0);

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

Consider the following method.

public double secret(int x, double y)

{

return x/2.0;

}

The return type of this function is double, so where it will store the result in a variable, that variable should be of double type. So, among given options, the correct option is double result = secret(4, 4.0);

All others options are incorrect and will give the error.

for example:

int result = secret(4, 4);

in it, the function secret is accepting first integer and second double parameters, while you are passing all integer variables.

int result = secret(4, 4.0);

you are not allowed to store double value into integer.

double result = secret(4.0, 4.0); in it you are passing incorrect types of parameter.

A company that offers services for accessing and using the Internet is: *

a public Wi-Fi provider
an Internet Service Provider (ISP)
a network
a modem

Answers

Answer:

The answer to this question is given below in the explanation section

Explanation:

A company that offers services for accessing and using Internet is an Internet Service Provider (ISP). ISP provides internet services to its customer for accessing the Internet and to connect with the world.

However, a public wifi provider is just a router who is sharing with other people the ISP services for Internet. It is also noted that a network is a connection between networks/computers etc. But a network can't provide services for accessing and using the internet.

Modem is used to modulate and demodulate the internet signal provided by ISP to the client.

Answer:

B. ISP

Explanation:

my name Jeff

what movie is this off of

Answers

Answer:

there is no movie name off of

There is no motive off of this.


I believe this is a vine. :P

Which of the following is a function of an audio programmer?

Answers

Answer:function of audio programmer

1. The audio programmer at a game development studio works under to integrate sound into the game and write code to manipulate and trigger audio cues like sound effects and background music.

Your answer is D. to integrate sound and music into the game

Hope this helps you

How does pharming work?

Answers

Answer:

Pharming, on the other hand, is a two-step process. One, cybercriminals install malicious code on your computer or server. Two, the code sends you to a bogus website, where you may be tricked in providing personal information. Computer pharming doesn’t require that initial click to take you to a fraudulent website.

Explanation:

what are the Technologies in regarding of communication technology? Please help me I'll rate you as brainliest!​

Answers

Answer:

Internet, multimedia, email and many more.

Explanation:

Communications technology, refers to all equipment and programs that are used to process and communicate information.

Communication Technology includes the Internet, multimedia, e-mail, telephone and other sound-based and video-based communication means.

Who PLAYS Apex Legend?

Answers

Answer:

me

Explanation:

Answer:

me :)

Explanation:

what is the purpose of primary manufacturing processes?

Answers

Answer:

Primary manufacturing processes are used to turn a raw material into an industrial material. Here's one type of primary manufacturing process 1)Chemical processes- using chemicals to change a raw material into an industrial material.

Answer:

used to turn a raw material into an industrial material.

Explanation:

Suppose that we are working for an online service that provides a bulletin board for its users. We would like to give our users the option of filtering out profanity. Suppose that we consider the words cat, dog, and llama to be profane. Write a program that reads a string from the keyboard and tests whether the string contains one of our profane words. Your program should find words like cAt that differ only in case. Option: As an extra challenge, have your program reject only lines that contain a profane word exactly. For example, Dogmatic concatenation is a small category should not be considered profane.

Answers

Answer:

Here is the JAVA program:

import java.util.*;   //to use Scanner class, Lists

public class Main{  //name of class

public static void main(String[] args) {  //start of main function

  String sentence = "CaT and catalog are not same";  //a string

  sentence = sentence.toLowerCase();  // converts the words in the sentence to lowercase

  Scanner sc = new Scanner(sentence);  //creates Scanner class object

  List<String> profane_words = profaneList();  // creates a list of profane words i.e. cat, dog and llama

  int count = 0;  //count the number of profane words

  while (sc.hasNext()) {  //reads string as tokens and returns true if scanner has another token

      String word = sc.next();  //returns the next complete token (word) and store it into word variable

      for (String profane : profane_words) {  // looks for each profane in profane_words list

          if (word.matches(".*\\b" + profane + "\\b.*") && ! sentence.matches(".*" + profane + "[a-z].*\\b" + profane + "\\b.*") && ! sentence.matches(".*[a-z]" + profane + ".*\\b" + profane + "\\b.*")) {  //uses matches() method that identifies whether a word in the string matches the given regular expression.

              count++;  //each time if the word of sentence matches with word given in profane_list then 1 is added to count

              System.out.println("The word " + profane + " is a profane!");  //displays the word which is profane

          }  }    }

  System.out.println("Number of profane words: "+ count);  }  //displays the number of profane words found in the sentence

private static List<String> profaneList() {  //list of profane words

  List<String> profane_words =  new ArrayList<>();  //creates an array list of profane words named as profane_words

  profane_words.add("dog");  //adds word "dog" to the list of profane words

  profane_words.add("cat");  //adds word "cat" to the list of profane words

  profane_words.add("llama");  //adds word "llama" to the list of profane words

  return profane_words;  }} //returns the list of profane words

Explanation:

I will explain the program with an example:

sentence = "CaT and catalog are not same";  

First this sentence is converted to lower case as:

sentence = "cat and catalog are not same";  

Now the while loop uses hasNext() which keeps returning the next token and that token is stored in word variable.

Next the for loop iterates through the list of profane_words to check each profane word with the word in a sentence.

Next this statement:

if (word.matches(".*\\b" + profane + "\\b.*") && ! sentence.matches(".*" + profane + "[a-z].*\\b" + profane + "\\b.*") && ! sentence.matches(".*[a-z]" + profane + ".*\\b" + profane + "\\b.*"))

uses regular expressions to find the profane words in the sentence. The logical operator&& AND between the three expressions is used so all of the three must hold for the if condition to evaluate to true.

word.matches(".*\\b" + profane + "\\b.*")  expression uses \b to check an exact match of the word. \b is meta-character to find a match at the beginning and at the end. So this checks if the word of a sentence matches with the profane in the profane list.

! sentence.matches(".*" + profane + "[a-z].*\\b" + profane + "\\b.*") && ! sentence.matches(".*[a-z]" + profane + ".*\\b" + profane + "\\b.*"))

These two expressions check if profane does not include as a part of another word in the sentence. This solves the extra challenge. Like here in the sentence we have a word catalog which is not a profane but a profane cat is included in this. So this will not be considered as a profane.

Every time a word matches with the profane from profane list, the value of count variable is incremented to 1.

In the end the statement:    

System.out.println("Number of profane words: "+ count);  

prints the number of profane words in the sentence.

List<String> profane_words =  new ArrayList<>(); creates the list of profane words and add() method adds the words to the list profane_words. So profane_words list contain "cat", "dog" and "llama"

Hence the output of this program is:

The word cat is a profane!                                                                                                                      Number of profane words: 1

The program output is attached in screenshot

What is an accurate definition of experience?

Answers

Answer:

I hope this helps

Explanation:

An accurate definition of experience might be a process of observing, encountering, or undergoing something. Experience can help your knowledge or practical wisdom gained up because of what one has observed, encountered, or undergone.

Suppose you need a spreadsheet application. When shopping for the right one, what is the most important factor to consider?
a. the keyboard layout
b. the type of pointing device you use
c. the operating system platform
d. the monitor size

Answers

Answer:

C.

Explanation:

A platform consists of an operating system, and the hardware. The hardware consists of the microprocessor, main storage, data bus and attached I/O devices (disks, display, keyboard, etc.). The operating system must be designed to work with the particular microprocessor's set of instructions.

C. the operating system platform

What is the most important program in an OS?

The most important systems program is the operating system. The operating system is always present when the computer is running. It coordinates the operation of all the hardware and software components of the computer system.

What is a platform system?

In IT, a platform is any hardware or software used to host an application or service. An application platform, for example, consists of hardware, an OS and coordinating programs that use the instruction set for a particular processor or microprocessor.

To learn more about operating system platform, refer

https://brainly.com/question/23880398

#SPJ2

A robot worker and a human worker are both vulnerable to

Answers

Answer:

fire

Explanation:

how is the flower be

Answers

Is there a passage to this? Or maybe an attachment?

Answer:

healthy cause they need water and sunshine

Which of the following statements is true concerning the Internet of Things (IoT)? Wearable technologies are the only devices that currently connect to the Internet of Things. IoT is not affecting many businesses and the products they offer. Growth is expected to slow down over the next five years. IoT technology is relatively new and is expanding exponentially.

Answers

Answer:

i was looking and i think the answer would be growth slowing down but i might be wrong

Explanation:

Which of the following statements is true concerning the Internet of Things IoT is that the technology is relatively new and is expanding exponentially.

The IoT is regarded as a large network of connected things and individual. They collect and share data about the way they are used and about the environment around them.

It is aimed to connect all potential objects to interact each other on the internet to provide secure and a more comfort life for people.

The future of IoT has the prediction to be limitless with great advances and the industrial internet will be accelerated.

Conclusively, the Internet of Things (IoT) connect the world together.

Learn more from

https://brainly.com/question/14397947

NEED HELP AS SOON AS POSSIBLE
A guideline for visual composition is to make use of lines. What do the following types of lines represent?

Vertical lines

Horizontal lines

Curved lines

Diagonal lines

Answers

Vertical: goes straight up and down parallel to the y-axis

Portrait and Landscape are

Question 4 options:

Page layout


Paper size


Page orientation


All of the above

Answers

Answer:

Page orientation

Explanation:

Required

What does portrait and landscape represent?

For better understanding, I'll narrow down the question to Microsoft Office Word. The explanation can be applied to other concepts.

Analysing the option one after the other.

Page layout: This is a term that describes the graphical representation of each document page, visually.

Page Size: This is a term that represents the length and width of the page. Common page sizes are LETTER, A4, A3, and so on.

The above (2) do not in any way represent what portrait and landscape represent.

Page orientation: This is a way the document is represented and it's a direct synonym for landscape and portrait.

Since (1) & (2) do not represented the given term, the last option is incorrect.

Hence,

Page orientation correctly answers the question

Answer:

Page orientation

Explanation:

I took the test

Return the "centered" average of an array of ints, which we'll say is the mean average of the values, except ignoring the largest and smallest values in the array. If there are multiple copies of the smallest value, ignore just one copy, and likewise for the largest value. Use int division to produce the final average. You may assume that the array is length 3 or more.centeredAverage({1, 2, 3, 4, 100}) → 3centeredAverage({1, 1, 5, 5, 10, 8, 7}) → 5centeredAverage({-10, -4, -2, -4, -2, 0}) → -3

Answers

Answer:

The code to this question can be defined as follows:

public double centeredAverage(ArrayList<Integer> nums) //defining a method centeredAverage that accepts an array nums

{

   if ((nums == null) || (nums.size() < 3))//define if block for check simple case value

   {

       return 0.0;//return float value

   }

   double sum = 0; //defining a double variable sum

   int smallest = nums.get(0);//defining integer variable and assign value

   int largest = nums.get(0);//defining integer variable and assign value

   for (int i = 0; i < nums.size(); i++) //defining for loop for stor ith value

   {

       int value = nums.get(i);//defining integer value variable to hold nums value

       sum = sum + value;//use sum variable for add value

       if (value < smallest)//defining if block to check value less then smallest

           smallest = value;//hold value in smallest variable  

       else if (value > largest)//defining else if block that checks value greater them largest value

           largest = value; //hold value in largest variable

   }

   sum = sum - largest - smallest;  // use sum to decrease the sum largest & smallest value

   return (sum / (nums.size() - 2)); //use return keyword for return average value

}

Explanation:

In the question, data is missing, that's why the full question is defined in the attached file please find it.

In the given code a method "centeredAverage" is used that accepts an array in its parameter and inside the method, if block is used that checks the cash value if it is true, it will return a float value.

In the next step, two integers and one double variable is defined, that use the conditional statement for check hold value in its variable and at the last use return keyword for return average value.

Other Questions
|x + 2|> 2How would you graph this solution It is believed that a mother language originally developed in _____.EurasiaAfricaIndiaAsia The Charter of 1732 established ____________ and ____________ for founding the colony of Georgia. *What words best fill in the blanks? Elena wants to make a scale drawing of her bedroom. Her bedroom is a rectangle with length 5 m and width 3 m. She decides on a scale of 1 to 50.Draw and label the dimensions of a scale drawing of Elena's bedroom, using a scale of 1 to 50.Elena's bedroom door is 0.8 m wide. How wide should the door be on the scale drawing? Explain how you know.Elena's bed measures 4 cm by 3 cm on the scale drawing. What are the actual measurements of her bed? PLEASE HELP MEE 15 POINTS the model represents a(n) A. Compound B. MixtureC. ElementD. Electrons How do you say we all have black hair in Spanish? (girls) In which country do macaques use coins in vending machines to buy snacks? Find the area of the triangle below.Be sure to include the correct unit in your answer. Help me answer this question:Explain each of the five components of CRAAPCRAAP Maine remained part of ____ until it seceded and became a state in 1820.ConnecticutMassachusettsNew HampshireNew YorkPennsylvaniaplease help 2. Find the equation of a line parallel to y=6x-4 and through point (-2,14) Scratch ploughs were often pulled byA. COWSB. goatsC. sheepD. donkeys give five characteristics of a metal Which problem solving strategy would be best to solve this problem?Four people are in line at the movie theater. Jennifer is ahead of Jeanie. John is not first or last in line. Jarett is directly in front of Jennifer. Name the order in which the people are standing in line.A.guess, check and revise.computer or simplifyC.work backwards.write an equation True or False. Cellulose is broken down in the human digestive system into glucose molecules. American colonists were forced to let British soldiers stay in their homes. This was one of several issues that led to?A. the passage of the Declaratory Act.B. the Boston Massacre.C. the Non-Importation Agreement.D. the Stamp Act What is the difference between rational and irrational numbers?put ur answer in simplest form. 1606 divided by 7 with work PLEASE HELP ASAP WILL GIVE BRAINLIEST!!! what is the volume of a rock in cubic cm (cm3^) with a mass of 156g and a known density of 1.93 g/cm3^ helppppppppp meeeeeee plsssssssss