update code in C++

instructions attached  below 

#include

#include

using namespace std;

const int ROWS = 8;

const int COLS = 9;

//P(sense obstacle | obstacle) = 0.8

float probSenseObstacle = 0.8;

//P(senses no obstacle | obstacle) = 1 – 0.8 = 0.2

float probFalseNoObstacle = 0.2;

//P(sense obstacle | no obstacle) = 0.15

float probFalseObstacle = 0.15;

//P(senses no obstacle | no obstacle) = 1 – 0.15 = 0.85

float probSenseNoObstacle = 0.85;

//Puzzle including a border around the edge

int maze[ROWS][COLS] =

{ {1,1,1,1,1,1,1,1,1},

{1,0,0,0,0,0,0,0,1},

{1,0,1,0,0,1,0,0,1},

{1,0,0,0,0,0,0,0,1},

{1,0,1,0,0,1,0,0,1},

{1,0,0,0,0,0,0,0,1},

{1,0,0,0,0,0,0,0,1},

{1,1,1,1,1,1,1,1,1},

};

//Matrix of probabilities

float probs[ROWS][COLS];

//Temporary matrix

float motionPuzzle[ROWS][COLS];

float sensingCalculation(int evidence[4], int row, int col)

{

float result = 1.0;

//If obstacle sensed to the west

if (evidence[0] == 1)

{

//If obstacle to the west in maze

if (maze[row][col – 1] == 1)

result *= probSenseObstacle;

//If no obstacle to the west in maze

else

result *= probFalseObstacle;

}

//If no obstacle sensed to the west

else

{

//If obstacle to the west in maze

if (maze[row][col – 1] == 1)

{

result *= probFalseNoObstacle;

}

//If no obstacle to the west in maze

else

{

result *= probSenseNoObstacle;

}

}

//If obstacle sensed to the north

if (evidence[1] == 1)

{

//If obstacle to the north in maze

if (maze[row – 1][col] == 1)

result *= probSenseObstacle;

//If no obstacle to the north in maze

else

result *= probFalseObstacle;

}

//If no obstacle sensed to the north

else

{

//If obstacle to the north in maze

if (maze[row – 1][col] == 1)

{

result *= probFalseNoObstacle;

}

//If no obstacle to the north in maze

else

{

result *= probSenseNoObstacle;

}

}

//If obstacle sensed to the east

if (evidence[2] == 1)

{

//If obstacle to the east in maze

if (maze[row][col + 1] == 1)

result *= probSenseObstacle;

//If no obstacle to the east in maze

else

result *= probFalseObstacle;

}

//If no obstacle sensed to the east

else

{

//If obstacle to the east in maze

if (maze[row][col + 1] == 1)

{

result *= probFalseNoObstacle;

}

//If no obstacle to the east in maze

else

{

result *= probSenseNoObstacle;

}

}

//If obstacle sensed to the south

if (evidence[3] == 1)

{

//If obstacle to the south in maze

if (maze[row + 1][col] == 1)

result *= probSenseObstacle;

//If no obstacle to the south in maze

else

result *= probFalseObstacle;

}

//If no obstacle sensed to the south

else

{

//If obstacle to the south in maze

if (maze[row + 1][col] == 1)

{

result *= probFalseNoObstacle;

}

//If no obstacle to the south in maze

else

{

result *= probSenseNoObstacle;

}

}

return result;

}

//Use evidence conditional probability P(Zt|St)

void sensing(int evidence[4])

{

float denominator = 0;

//Calculates denominator

for (int r = 0; r < ROWS; r++)

{

for (int c = 0; c < COLS; c++)

{

if (maze[r][c] != 1)

{

denominator += sensingCalculation(evidence, r, c) * probs[r][c];

}

}

}

for (int row = 0; row < ROWS; row++)

{

for (int col = 0; col < COLS; col++)

{

//If the current space isn’t an obstacle

if (maze[row][col] != 1)

{

float currentProbabilty = probs[row][col];

float numerator = sensingCalculation(evidence, row, col) * currentProbabilty;

float result = numerator / denominator;

probs[row][col] = result;

}

}

}

}

//Use transition probability P(St|St-1)

void motion(int direction)

{

for (int row = 0; row < ROWS; row++)

{

for (int col = 0; col < COLS; col++)

{

if (maze[row][col] != 1)

{

float total = 0.0;

//north

if (direction == 1)

{

//checking west

if (maze[row][col – 1] != 1)

{

total += probs[row][col – 1] * 0.1;

}

else

{

total += probs[row][col] * 0.1;

}

//checking north

if (maze[row – 1][col] != 1)

{

total += probs[row – 1][col] * 0;

}

else

{

total += probs[row][col] * 0.8;

}

//checking east

if (maze[row][col + 1] != 1)

{

total += probs[row][col + 1] * 0.1;

}

else

{

total += probs[row][col] * 0.1;

}

//checking south

if (maze[row + 1][col] != 1)

{

total += probs[row + 1][col] * 0.8;

}

else

{

total += probs[row][col] * 0;

}

}

//west

else if (direction == 0)

{

//checking west

if (maze[row][col – 1] != 1)

{

total += probs[row][col – 1] * 0;

}

else

{

total += probs[row][col] * 0.8;

}

//checking north

if (maze[row – 1][col] != 1)

{

total += probs[row – 1][col] * 0.1;

}

else

{

total += probs[row][col] * 0.1;

}

//checking east

if (maze[row][col + 1] != 1)

{

total += probs[row][col + 1] * 0.8;

}

else

{

total += probs[row][col] * 0;

}

//checking south

if (maze[row + 1][col] != 1)

{

total += probs[row + 1][col] * 0.1;

}

else

{

total += probs[row][col] * 0.1;

}

}

motionPuzzle[row][col] = total;

}

else

{

motionPuzzle[row][col] = -1;

}

}

}

for (int r = 0; r < ROWS; r++)

{

for (int c = 0; c < COLS; c++)

{

probs[r][c] = motionPuzzle[r][c];

}

}

}

void printPuzzle(float puzzle[ROWS][COLS])

{

for (int row = 0; row < ROWS; row++)

{

for (int col = 0; col < COLS; col++)

{

if (puzzle[row][col] == -1)

cout << "##### ";

else

cout << setprecision(2) << fixed << puzzle[row][col] * 100.0 << "  ";

}

cout << endl;

}

}

int main()

{

//Initial probability matrix

for (int row = 0; row < ROWS; row++)

{

for (int col = 0; col < COLS; col++)

{

if (maze[row][col] == 0)

{

probs[row][col] = (1.0 / 38);

}

else

{

probs[row][col] = -1;

}

}

}

printPuzzle(probs);

cout << endl;

int s1[4] = { 0, 0, 0, 0 };

sensing(s1);

printPuzzle(probs);

cout << endl;

//1 = north

motion(1);

printPuzzle(probs);

cout << endl;

int s2[4] = { 1,0,0,0 };

sensing(s2);

printPuzzle(probs);

cout << endl;

//1 = north

motion(1);

printPuzzle(probs);

cout << endl;

int s3[4] = { 0,0,0,0 };

sensing(s3);

printPuzzle(probs);

cout << endl;

//0 = west

motion(0);

printPuzzle(probs);

cout << endl;

int s4[4] = { 0,1,0,1 };

sensing(s4);

printPuzzle(probs);

cout << endl;

//0 = west

motion(0);

printPuzzle(probs);

cout << endl;

int s5[4] = { 1,0,0,0 };

sensing(s5);

printPuzzle(probs);

cout << endl;

return 0;

}

Objectives: Perform form validation

  

Objectives: Perform form validation
Manipulate form fields
Requirements: Download orderform.html for this lesson.
Add a link to the jQuery library and the external JavaScript file to the html page.
Put the cursor in the username field
Add validation to the form fields whenever the user moves off the form field as follows:
Name – required – non-blank
Email – required, valid email address (use regex)
Address & City, Shipping Address & city – required – non-blank
Zip code, Shipping zip code – required, numeric, 5 characters
If an error is found, display an appropriate error message in the associated span error tag beside the field.
If no error is found, set the text of the error field to nothing (to remove any previously displayed error messages).
When the user changes the Copy address checkbox:
If the checkbox is checked, copy the billing address, city and zip to the corresponding shipping fields
Add an entry to the state dropdown list as selected with the state from the billing state dropdown list.
When the user moves off of a quantity control (class =”qty”):
Initialize an ordertotal to 0
For each quantity:
get the quantity value entered. If it is not numeric, change it to 0
get id to use to identify the associated price and total
get the price text by using the id “price” + the index value
multiply price times quantity to get a total
Put the total in the table cell with id “total”+index
Add the total to the ordertotal
Place the order total in the subtotal cell.
If ship state is “TX”, calculate tax of .08 times the total and put in the tax cell. Use 0 for all other states.
Add tax to ordertotal.
Calculate shipping based on the shipping state and place it in the shipping cell.:
“TX”: $5.00
“CA” & “NY”: $20
all others: $10
Add shipping to the ordertotal
Display the ordertotal in the Grand Total cell.
When the form is submitted, revalidate all the fields. If the data is not valid, cancel submission of the form.

Writing

Refer to Assurance of Learning Exercise #1 (Apple) in Chapter One of your Thompson (2022) text. Read “Apple Inc: Exemplifying a Successful Strategy” in Illustration Capsule 1.1.Incorporate our course (Thompson text) work for the week and dDevelop your analysis by responding to the following questions:

  • Does Apple’s strategy seem to set it apart from rivals?
  • Does the strategy seem to be keyed to a cost-based advantage, differentiating features, serving the unique needs of a niche, or some combination of these? Explain why?
  • What is there about Apple’s strategy that can lead to sustainable competitive advantage?

Submission Details: 

  • Your analysis should be 500 words or less.
  • Incorporate a minimum of at least our course Thompson 2022 Text and one non-course scholarly/peer-reviewed sources in your paper to support your analysis.
  • All written assignments must be formatted ini APA, and  include a coverage page, introductory and concluding paragraphs, reference page, and proper in-text citations using APA guidelines.
  • Due by 11:59 pm EST on Day 7, Sunday.

Exception Handling Case 1

 ***Must Use Eclipse for this assignment***

Case Assignment Overview

Write a Java application to calculate how much federal and state tax  you need to pay. The program should accomplish the following tasks: ask  your name, yearly income, federal tax rate, and state tax rate, then  calculate and display the amount of tax you need to pay. Your program  must catch user input errors. As the examples given above, use a dialog  window to enter program input instead of console-based commands.  After  you are done, zip “compress” the java source file along with some screen  shots of your output and submit.

Assignment Expectations

Ability to use checked exceptions in a Java program.

Mobile Device Use

Mobile devices

  • What are the most used features in your mobile device?
  • What is your favorite app and why?
  • Have you used AirDrop, Google Drive, Dropbox, or other cloud based file systems? I have used them all.  How do you use them?
  • What is your experience with virtual assistants such as Google, Siri, or even Alexa?
  • What is the best way to secure your mobile device? I use my digital security password, fingerprint & facial recognition 

2 Discussions and 1 case Study

Discussion 5.1

What is the Model Builder? Explain. 

Provide the examples of the industries where it will it be the most useful.

Discussion 5.2

When will be useful to apply for Spatial Analyst extension? Give some examples. 

Minimum 110 words excluding references 

Case Study 6.1

Case Study 12.1 The Problems of Multitasking

  1. How does multitasking confuse the resource availability of project team personnel?
  2. “In modern organizations, it is impossible to eliminate multitasking for the average ­employee.” Do you agree or disagree with this statement? Why?
  3. Because of the problems of multitasking, project managers must remember that there is a difference between an activity’s duration and the project calendar. In other words, 40 hours of work on a project task is not the same thing as one week on the baseline schedule. Please comment on this concept. Why does multitasking “decouple” activity duration estimates from the project schedule?

Writing Requirements

  • 2-3 pages in length  (excluding cover page, abstract, and reference list)
  • APA 6th edition, Use the APA template located in the Student Resource Center to complete the assignment.
  • Please use the Case Study Guide as a reference point for writing your case study.

DFA

  

EXERCISE 1 

For each of the following strings, say whether it is in the language accepted by this DFA: