1. The programmer intends for this pseudocode to display three random numbers in the range of 1 through 7. According to the way we’ve been generating random numbers in this book, however, there appears to be an error. Can you find it?

Answers

Answer 1

Answer:

Display random(1, 7).

Explanation:

In the following question, some details of the question are missing that is pseudocode.

//  Program shows three random numbers

// the range of 1 to 7.

Declare the Integer count

// Shows three random numbers.

For count = 1 To 3

Display random(7, 1)

End For

In the following pseudocode, it generates three random numbers from 1 to 7 because the for loop statement is starts from 1 and end at 3 so the loop will iterate three times and every time it generates one random number from 1 to 7. So, the following are the reason that describe the answer is correct according to the scenario.

Answer 2
Final answer:

The issue with the pseudocode might be related to the exclusive nature of the upper boundary in many random number generator methods. The programmer may need to add 1 to the function to generate values inclusive of 7.

Explanation:

Without seeing the actual pseudocode, it's tough to give a specific correction. However, the common error in generating random numbers is not considering the exclusive nature of the upper boundary in random number methods. Most methods generate numbers from 0 (inclusive) up to the specified upper limit number (exclusive).  To generate random numbers within the range from 1 to 7 (inclusive), the code should add 1 to the random output. Therefore, a possible correction would be to modify the random number generator function to include 7 and exclude 0.

For example, in many programming languages, one could use a function similar to '1 + Math.floor(Math.random() * 7)', ensuring that we generate random numbers between 1 and 7 inclusive. Kindly refer to the specific programming language practices when implementing.

Learn more about Random Number Generation here:

https://brainly.com/question/32196150

#SPJ3


Related Questions

Which of the following is NOT a disadvantage of a simulation? An optimal solution cannot be guaranteed, but relatively good ones are generally found. Simulation software sometimes requires special skills because of the complexity of the formal solution method. Simulation model construction can be a slow and costly process, although newer modeling systems are easier to use than ever. Simulation is often the only DSS modeling method that can readily handle relatively unstructured problems.

Answers

Answer:

D. Simulation is often the only DSS modeling method that can readily handle relatively unstructured problems.

Explanation:

One of the advantages of simulation is that simulation is often the only DSS modeling method that can readily handle relatively unstructured problems.

Simulation is an imitation of reality which is carried out on a computer. It starts by first defining a problem that needs to be solved then a simulation model is constructed after that experiments are conducted and results are evaluated and then optimization is done where needed.

Decision Support Systems (DSS) is a simulation based information system that helps in decision making by incorporating various models to imitate real world scenarios. These models are capable of handling semi-structured or unstructured data that is in-fact one of the advantages of simulation.

Suppose the fixed width of an aside element in a fixed layout is 300 pixels, and the fixed width of its parent element (body) is 900 pixels. If you convert the page from fixed to fluid layout, the width of the aside should be set to
answer choices
a. 33.33%
b. 0333
c. 300%
d. 3

Answers

Answer:

The width of the aside should be set to 33.33%

Explanation:

Given:

Let F1 = Fixed width of an aside element in a fixed layout

F1 = 300 pixels

Let F2 = Fixed width of its parent element (body)

F2 = 900 pixels

Let W = The width, after converting the page from fixed to fluid layout

W is calculated as F1/F2

W = F1/F2

W = 300 pixels/900 pixels

W = 300/900

W = 0.3333 ---- Convert to percentage

W = 33.33%

Hence, the width of the aside should be set to 33.33%

Use a correlated subquery to return one row per customer, representing the customer’s oldest order (the one with the earliest date). Each row should include these three columns: email_address, order_id, and order_date.

CUSTOMERS TABLE: CUSTOMER_ID, EMAIL_ADDRESS, PASSWORD, FIRST_NAME, LAST_NAME, SHIPPING_ADDRESS_ID, BILLING_ADDRESS_ID

ORDERS TABLE: ORDER_ID, CUSTOMER_ID, ORDER_DATE, SHIP_AMOUNT, TAX_AMOUNT, SHIP_DATE_SHIP_ADDRESS_INFO, CARD_TYPE, CARD_NUMBER, CARD_EXPIRES, BILLING_ADDRESS_ID

Answers

Final answer:

To provide each customer's oldest order, a SQL query with a correlated subquery is used. This query joins the CUSTOMERS and ORDERS tables and matches the earliest order_date for each customer.

Explanation:

To find each customer's oldest order using a correlated subquery, you would need to join the CUSTOMERS table with the ORDERS table based on the CUSTOMER_ID and then compare ORDER_DATEs. The query will return one row per customer containing their email_address, order_id, and order_date for the oldest order. Here is an example of how that SQL query may look:

SELECT c.EMAIL_ADDRESS, o.ORDER_ID, o.ORDER_DATE FROM CUSTOMERS c JOIN ORDERS o ON c.CUSTOMER_ID = o.CUSTOMER_ID WHERE o.ORDER_DATE = ( SELECT MIN(sub_o.ORDER_DATE) FROM ORDERS sub_o WHERE sub_o.CUSTOMER_ID = c.CUSTOMER_ID )

In this correlated subquery, 'sub_o' is an alias for the ORDERS table and is used to retrieve the minimum ORDER_DATE (the earliest) for each customer by comparing it with the ORDER_DATE in the outer query.

1.What is the ITIL? A.A set of process-oriented best practices B.A group of metrics that govern the program C.Focuses on value delivery D.All of the above

Answers

Information Technology Infrastructure Library (ITIL) is

A set of process-oriented best practicesA group of metrics that govern the programFocuses on value delivery

Option D- All of the above

Explanation:

The process ITIL can be defined as a set of well-defined practices for the IT service management which takes concerns on aligning the IT services based on the requirements of the business.

This describes the tasks, procedures, checklists and processes that are specifically not for organization or technology but can be adapted by the business entity towards the delivering-value, strategy or handling a lower competency level.

ITIL process was developed around as a process model-based view of managing and controling the operations of the organization which is credited to W. Edwards Deming and his plan-do-chec-act (PDCA) cycle.

You must install JMP pro on your computer before attempting this assignment. You must use the data file: MedicalMalpractice. JMP. Read the case very carefully and answer the questions (fill in the blanks) when necessary. In addition, you must reproduce all the exhibits (via screenshots of your work) by following the instructions provided in the case. Exhibit 1 [1.5 pt] a. The mean (average) payment is _ while the median (middle) is _. When a histogram is right skewed, as is the case here, the mean will exceed the median.

Answers

Answer:

Explanation:

Deliverable:

Create a word document and answer all the questions and attach the screen shot of all the figures in the case (Exhibit-1 to 11). The first page of your document must have your full name and student ID.

Analysis

We begin by looking at the key variable of interest, the amount of claim payment. Exhibit 1 displays a histogram and summary statistics for Amount.

Exhibit 1 Distribution of Amount

(Analyze > Distribution; Select Amount as Y, Columns, and click OK. For a horizontal layout select Stack under the top red

triangle.)

From Exhibit 1 we see that the histogram of Amount is skewed right, meaning that there is a long tail,

with several very high payments. The mean (average) payment is _______ while the median (middle) is

___________. When a histogram is right skewed, as is the case here, the mean will exceed the

median. This is because the mean is influenced by extreme values – the high payments that we

observe in the histogram inflate the mean.

A measure of the spread of the data is the standard deviation (StdDev in Exhibit 1). The higher the

standard deviation, the larger the spread, or variation, in the data. When the data are skewed, the

standard deviation, like the mean, will be inflated.

Other useful summary statistics are the quartiles. The first quartile (next to 25.0% in Exhibit 1) is

________ and the third quartile (next to 75.0%) is __________. The interquartile range, defined as Q3 –

Q1, is a measure of the amount of spread or variability in the middle 50% of the data. This value is

displayed graphically in the outlier box plot (above the histogram). A larger version of this plot is

displayed below.

The left edge of the box is the first quartile, the center line is the median or second quartile, and the right

edge of the box is the third quartile. Hence, the width of the box is the interquartile range, or IQR.

1.5 pt.

(Find attached histogram diagram)

1. Rectangle Area The area of a rectangle is calculated according to the following formula: Area=Width×LengthArea=Width×Length Design a function that accepts a rectangle’s width and length as arguments and returns the rectangle’s area. Use the function in a program that prompts the user to enter the rectangle’s width and length, and then displays the rectangle’s area.

Answers

Answer:

The method is given below.

double area(double w, double l)

{

   double area = w*l;

   return area;

}

Explanation:

The cpp program using the above method is given below.

#include <iostream>

using namespace std;

double area(double w, double l)

{

   double area = w*l;

   

   return area;

}

int main() {

   

   // variables to hold parameters of the rectangle

   double width;

   double length;

   

   // user asked to enter parameters of the rectangle

   cout<<"Enter the width of the rectangle: ";

   cin>>width;

   

   cout<<"Enter the length of the rectangle: ";

   cin>>length;

   

   // area of the rectangle returned by area() and displayed

   cout<<"The area of the rectangle is "<<area(width, length)<<endl;

   

   return 0;

}

OUTPUT

Enter the width of the rectangle: 12

Enter the length of the rectangle: 8.9

The area of the rectangle is 106.8

The program includes the following.

1. The area() method takes two double parameters as argument of the rectangle.

2. The area() method computes the area using the arguments and returns this value.

3. The area() method has return type of double.

4. The area() method has a double variable, area, which holds the product of the arguments.

5. The main() method has return type of integer and returns an integer value. This is done to assure successful execution of the program.

6. Inside main(), two double variables are declared.

7. User is prompted to enter the parameters of the rectangle which are stored in these variables.

8. The user input is passed to the area() method as parameters.

9. This method returns the computed value of the area of the rectangle.

10. The area is displayed to the console. A new line is inserted at the end of the output.

11. All the variables are declared with double datatype to accommodate both decimal and non-decimal values.

12. All the code is written inside the respective method. No classes are used.

1. (15%) Consider a computer system with three users: Alice, Bob, and Cyndy. Alice owns the file a, and Bob and Cyndy can read it. Bob owns the file b, and Cyndy can read and write the file b, but Alice can only read it. Cyndy owns the file c, but neither Alice and Bob can read or write it. If a user owns a file, he/she can also execute the file.(a) Create the ACM (access control matrix) of the system.(b) Show the ACL of the ACM and the CL of the ACM.(c) Cyndy gives Alice permission to read c, and Alice removes Bob's ability to read a. Show the ACM after these changes.

Answers

Answer:

answered in Image and explanation is given below.

Explanation:

CL is euqal to user permission on every file

ACL is equal to how permissions are defined for one life for example File a, read, write, execute.

#Write a function called hide_and_seek. The function should #have no parameters and return no value; instead, when #called, it should just print the numbers from 1 through 10, #follow by the text "Ready or not, here I come!". Each #number and the message at the end should be on its own #line. #

Answers

Answer:

# hide_and_seek function is defined

def hide_and_seek():

# for loop from 1 to 10

# and print each number

for number in range(1, 11):

print(number)

# the last message is displayed on its own line

print("Ready or not, here I come!")

# the function is called

hide_and_seek()

Explanation:

The code is well commented. A sample image of the output when the code is executed is attached.

Final answer:

The hide_and_seek function is written in Python and prints numbers 1 through 10 on separate lines, followed by "Ready or not, here I come!" on its own line. The function uses a for loop and requires no parameters or return values.

Explanation:

Writing the hide_and_seek Function

To write a function called hide_and_seek that prints numbers from 1 through 10 followed by the message "Ready or not, here I come!", you can use the Python programming language. This function does not require any parameters to be passed and does not return any value. Instead, it performs an action by printing out a series of statements. Here is how you can define this function:

def hide_and_seek():
   for i in range(1, 11):
       print(i)
   print("Ready or not, here I come!")

When you call this function using hide_and_seek(), it will execute a loop that prints each number from 1 to 10, each on a new line, and then it prints the message "Ready or not, here I come!" also on a new line.

Write a program roman which converts numbers from decimal notation into Roman numerals. roman takes a single argument, a string containing a non-negative integer, and prints its Roman numeral equivalent to standard output. g

Answers

Answer:

// Program is written in C++ programming language

/ Comments are used for explanatory purpose

// Program starts here

#include<bits/stdc++.h>

using namespace std;

//Declare a function named value to represent the symbols of Roman Numerals

int value(char xy)

{

if (xy == 'I') { return 1; }

if (xy == 'V') { return 5; }

if (xy == 'X') { return 10; }

if (xy == 'L') { return 50; }

if (xy == 'C') { return 100; }

if (xy == 'D') { return 500; }

if (xy == 'M') { return 1000; }

return -1;

}

// Convert to numbers , taking Variable named input as input

int Converted(string &input)

{

// Declare a variable to store the calculated output

int calc;

// Set to 0

calc = 0;

// Iterate through input from 0 to the last character

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

{

int check1 = value(input[i]);

if (i+1 < input.length())

{

int check12= value(input[i+1]);

// Comparing both values

if (check1>= check2)

{

calc+ =check1;

}

else

{

calc+ =check2 - check1;

i++;

}

}

else

{

calc+ =check1;

}

}

return calc;

}

// Main method starts here

int main()

{

// String input declaration

string inp;

cout<"Enter any valid Roman numeral";

cout << "Result is "

<< Converted(inp);

return 0;

}

Discuss how the following pairs of scheduling criteria conflict in certain settings.a. CPU utilization (efficiency) and response timeb. Average turnaround time and maximum waiting timec. I/O device utilization and CPU utilization g

Answers

Answer:

CPU utilization (efficiency) and response timeb. Average turnaround time and maximum waiting timec. I/O device utilization and CPU utilization g

Explanation:

1. CPU utilization (efficiency) and response time

CPU utilization could be maximized by reducing the context switching. Context switching is the switching of one task by CPU by avoiding the conflict.  The context switching could be minimized by doing less context switching meanwhile the processing. When the context switching is minimum then the response time will be maximum.

Minimum context switching --------------------> Maximum CPU utilization

Minimum switching of the CPU bound tasks could maximize the CPU utilization

CPU utilization is very important for the performance of the multitasking. WE could perform the multi tasking if the CPU utilization is maximum, Memory is free and i/o devices are available for the usage.

2.Average turnaround time and maximum waiting time

Average turnaround time could be reduced by executing the shortest job first. By using the scheduling policy we make it possible that the short and less time taking task will be performed first by in this way the long run task has to wait a lot.

Shortest Job First--------------> Reduce the average turnaround time

SJF= Shortest job will be executed first

SJF= long job need to wait for the longer time which will increase the waiting time

3.I/O device utilization and CPU utilization

CPU utilization could be maximized by performing the CPU bound task first without doing the context switching.

CPU maximum utilization= Run long running CPU bound tasks without the context switching.

I/O devices utilization could be maximized by doing the I/O bound tasks as soon as they are ready to run by keeping the context of context switching as well.

maximum I/O utilization= Run I/O bound device first when they ready to run by keeping the context switching on the board

Part(a):

CPU Utilisation:

is associated with the context switching time. We know that context switching takes a certain amount of time. So if more context switching will be there, the CPU will spend most of its time doing the context switching which will reduce the overall CPU utilization. So in order to have better CPU utilization, context switching should be less. But reducing the context switching will increase the response time of the process as the CPU will be busy fulfilling the request which came earlier and the other processes will be in the waiting queue. So, increasing CPU utilization by reducing context switching can increase the response time.

Part(b): The Time interval from the time of submission of a process to the time of completion is known as turnaround time. In order to minimize the average turnaround time, we should try to execute those processes first which takes less amount of time to execute. So before going to the long-running tasks, we should try to complete the short-running tasks. But using this scheduling algorithm can cause starvation for long-running tasks as this algorithm will always try to execute those processes which are shortest and if the processes will be keep coming, long-running tasks will always be in the waiting queue. Time

Part(c): CPU utilization can be maximized if the CPU will spend less time doing the context switching. This can be done if we schedule long-running CPU-bound jobs first. So scheduler should always choose to schedule CPU-bound jobs first before scheduling and I/O bound jobs. Once the I/O bound jobs are ready to run, we should schedule these jobs in order to maximize the I/O device utilization.

Learn more about the topic of CPU utilization:

https://brainly.com/question/16557295

A perfect binary tree is a complete binary tree with all levels fully filled. Add a method in the BST class to return true if the tree is a perfect binary tree.

Answers

Answer:

class BST {

static class Node

{

int val;

Node left, right;

}

static boolean checkPerfectBT(Node node, int h, int d)

{

if (node == null)

return true;

 

if (node.left == null && node.right == null)

{

if(h==d+1)

return true;

else

return false;

}

 

if (node.left == null || node.right== null)

return false;

 

return checkPerfectBT(node.left, h, d+1) && checkPerfectBT(node.right, h, d+1);

}

static int height(Node node)

{

int dep = 0;

while (node != null)

{

node = node.right;

dep=dep+1;

}

return dep;

}

static boolean isPerfectBT(Node node)

{

int h = height(node);

return checkPerfectBT(node, h, 0);

}

 

static Node addNode(int x)

{

Node node = new Node();

node.val= x;

node.right = null;

node.left = null;

return node;

}

public static void main(String args[])

{

int i,j,k;

Node node= null;

node = addNode(34);

node.left = addNode(2);

node.right = addNode(322);

 

node.left.left = addNode(21);

node.left.right = addNode(23);

node.right.left = addNode(37);

node.right.right = addNode(54);

 

if (isPerfectBT(node) == true)

System.out.println("This is a Perfect Binary tree");

else

System.out.println("This is Not a perfect Binary Tree");

}

}

Explanation:

Calculate the depth of BST by using a while loop until it reaches a null value.In the addNode method, make an object of Node class.In the main method, pass the values to addNode method.Finally display the relevant message to show if it's Perfect or not.

You're helping Professor Joy to calculate the grades for his course. The way his course is organised, students take two exams and their final grade is the weighted average of the two scores, where their lowest score weights 70% and their highest score 30%.

To accomplish this, you are going to need to do the following:

(1) Build the Student named tuple with the following attributes:

name (string)
exam1 (float)
exam2 (float)
(2) Write a function create_student, which will ask the user to input a single student's name, exam 1 score, and exam 2 score. The function will then create a named tuple with this information and return it.

(3) Write a function create_class, which takes as input an integer n, calls create_student n times and returns a list with the n students created.

(4) Write a function calculate_score, which takes a single Student named tuple as input, and returns the final score, where their lowest grade is weighted 70% and their highest grade is weighted 30%.

(5) Print the value returned by calculate_score for each student created in main. Round each score to two decimal places (using round(value, 2)).

Example 1: if the input is:

1
Student 1
10
0
then the output is:

3.0
Example 2: if the input is:

2
Student 1
10
0
Student 2
7
8
then the output is:

3.0
7.3
Example 3: if the input is:

0
then the output is:

Code:

from collections import namedtuple

''' Build named tuple here '''

''' Write Functions Here '''

if __name__ == "__main__":
''' Call functions and print here '''

Answers

Answer:

C++.

Explanation:

#include <iostream>

#include <string>

using namespace std;

///////////////////////////////////////////////////////////////////

struct Student {

   string name;

   float exam1;

   float exam2;

};

///////////////////////////////////////////////////////////////////

Student create_student() {

   string name;

   cout<<"Name: ";

   cin>>name;

   float exam1;

   cout<<"Exam 1: ";

   cin>>exam1;

   

   float exam2;

   cout<<"Exam 2: ";

   cin>>exam2;

   

   Student s;

   s.name = name;

   s.exam1 = exam1;

   s.exam2 = exam2;

   return s;

}

///////////////////////////////////////////

Student* create_class(int n) {

   Student* arr = new Student[n];

   

   for (int i=0; i<n; i++) {

       cout<<"Student "<<i+1<<endl;

       arr[i] = create_student();

       cout<<endl;

   }

   

   return arr;

}

///////////////////////////////////////////

float calculate_score(Student s) {

   int final_score = 0;

   

   if (s.exam1 >= s.exam2) {

       final_score = (s.exam1 * 0.3) + (s.exam2 * 0.7);

   }

   else {

       final_score = (s.exam1 * 0.7) + (s.exam2 * 0.3);

   }

   

   return final_score;

}

///////////////////////////////////////////////////////////////////

int main() {

   Student* s;

   int n;

   ////////////////////////////////////

   cout<<"How many students? ";

   cin>>n;

   cout<<endl;

   s = create_class(n);

   ////////////////////////////////////

   for(int i=0; i<n; i++) {

       float final_score = calculate_score(s[i]);

       printf("Final score for Student %d %.2f", i+1, final_score);

       cout<<endl;

   }

   ////////////////////////////////////

   return 0;

}

You are given the following code snippet which executes on a 5-stage pipelined processor. How many cycles does the code take to execute, if no data bypassing is implemented ?

addi $s1, $0, 10
lw $t0, 4($s0)
srl $t1, $t0, 1
add $t2, $t1, $s1
sw $t2, 4($s0)

a. 5
b. 9
c. 10
d. 14

Answers

5-Stage Pipeline Diagram for given set of instructions is given below. From the table we get to know that given code snippet need 14 clock cycles to execute with 5 stage pipelines without bypassing technique.

Option: (d)

Explanation:

If there is hazard on one instruction immediately after load/store or memory instructions then there is more delay than usual. So, we use two stalls for hazard present immediately after load instruction i.e. instruction 2.

IF denotes fetch instruction. ID denotes Decode instruction .EX for execution and MEM for memory-based Operations. WB foe register read/Write operations used for stall ir delay.

Case ExercisesThe nest day at SLS found everyone in technical support busy restoring computer systems to their former state and installing new virus and worm control software. Amy found herself learning how to re-install desktop computer operating systems and applications as SLS made a heroic effort to recover from the attack of the previos day.Discussion Questions1. Do you think this event was caused by an insider or outsider? Explain your anwer.2. Other than installing virus and worm control software, what can SLS do to prepare for the nest incident?3. Do you think this attack was the result of a virus or a worm? Explain your answer.

Answers

Answer:

In the explanation section, the further description of the problem is defined.

Explanation:

(1) According to the above paragraph, this isn't obvious what kind of assault it would be, It could be an attacker or maybe an outsider assault that has contributed to the re-installation and restore of the applications.

(2) Apart from just downloading the SLS malware configuration tool, the records also should be thoroughly checked as well as the server and devices monitored and the new virus, ransomware defenses enabled, and also the authentication method should be followed to avoid such future attacks.

(3) Sure, this intrusion may have been due to malware that infected the documents as well as the network.

It could also be attributed to data theft, due to which networks have not responded as a consequence from which the devices have been reinstated.

So, it's the right answer.

I would say that the attack was caused by an outsider because everyone in technical support were affected.

What is information security?

Information security can be defined as a preventive practice which is used to protect an information system (IS) that use, store or transmit information, from potential theft, attack, damage, or unauthorized access, especially through the use of a body of technology, frameworks, processes and network engineers.

Based on the scenario, I would say that the attack was caused by an outsider because more often than not cyber attacks are mainly orchestrated by external actors (hackers).

Aside installing virus and worm control software, SLS can prepare for the next incident by adopting the principle of least privilege and use an intrusion prevention system (IPS).

In conclusion, I strongly think the attack was the result of a worm because it seems the threat spread from a standalone malware computer program to other workstations.

Read more on information security here: https://brainly.com/question/14286078

Write the class Calculator including: a function called addthat takes two parameters containing double values and returns their sum a function called subtractthat takes two parameters containing double values and returns their difference (subtract the second from the first) a function called multiply that takes two parameters containing double values and returns their product a function called divide that takes two parameters containing double values and returns the value of the first divided by the second. If the second number is a zero, do not divide, and return "You can't divide by zero!"

Answers

Answer:

public class Calculator {

       public double add(int a, int b){

       return a+b;

   }

   public double substract(int a, int b){

       return a-b;

   }

   public double multiply(int a, int b){

       return a*b;

   }

   public double divide(int a, int b){

       if(b>0){

           return a/b;

       }

       else{

           System.out.println("Cannot divide by zero");

       }

       return -1;

   }    

}

Explanation:

Using Java Programming Language, the class Calculator is created. There are no fields (Instance variables) and no constructors since these are not required by the question.Four methods (functions) are created:  add, substract, multiply and divide as specified in the question.Note the use of the if statement in the divide() to handle case of illegal division (by 0)

A ball is released from a 10 m high roof and bounces two thirds as high on each successive bounce. After traveling a total of 40 m (up and down motion), how many times did the ball bounce (e.g. touch the ground)? Put the answer in

Answers

Answer:

Four times traveling 40,12345 mts

Explanation:

We can express this as a sum as follows

[tex]\sum_{i=1}^4(10\cdot \frac{2}{3}^{i - 1} + 10\cdot \frac{2}{3}^{i } ) = 3250/81=40.12345679[/tex]

The first term is the dropping part and the second is the upward motion. this sums up to 40,12345 m after bouncing four times. As a program we could write using the while loop.

distance=0;

i:=0;

while distance<40 do

i:=i+1;

distance:=distance+ [tex]10\cdot \frac{2}{3}^{i - 1} + 10\cdot \frac{2}{3}^{i };[/tex]

end while;

Here the answer is in i and the closest distance traveled after reaching 40 is in the variable distance.

Final answer:

The ball bounces 3 times after being released from a 10 m height to cover a total distance of 40 m, considering each bounce reaches two-thirds of the height of the previous bounce.

Explanation:

We are tasked with finding how many times a ball bounces when dropped from a 10 m height, given that it bounces two-thirds of its previous height with each bounce and that the total distance covered up and down is 40 m. This is a geometric series problem, where each bounce can be considered a term in the series.

The total distance covered by the ball includes its initial fall plus the subsequent bounces. The initial fall is 10 m. For each bounce, the ball travels up and then down the same distance, effectively doubling the distance covered per bounce in relation to its height. Let's designate the number of bounces as n and the total distance traveled as D, with D=40 m.

The sequence for the distances covered by the ball after each bounce forms a geometric series: 10 + 2*(10*(2/3)) + 2*(10*(2/3)^2) + ... + 2*(10*(2/3)^n). The sum of this infinite series can be found via the formula for the sum of a geometric series, S = a / (1 - r), where a is the first term and r is the common ratio. However, in this problem, we know the sum (S = 40 m) and need to find the number of terms (n).

Upon solving, it becomes apparent the question involves determining n based on cumulative distance rather than solving directly with the formula. With the first drop and subsequent bounces, by setting up the terms and considering the total distance, we observe that the ball bounces 3 times to cover a distance slightly over 40 m.

In python please:
Design a program that asks the user to enter a store’s sales for each day of the week. The amounts should be stored in a list. Use a loop to calculate the total sales for the week and display the result.

Answers

Answer:

declare a list and loop through to get the total sales

Explanation:

input_string = input("Enter sales: ")

userList = input_string.split()

print("user list is ", userList)

print("Calculating total of the sales")

sum = 0

for num in userList:

   sum += int(num)

print("Total sales= ", sum)

We are asked to design a database management system for all information related to a real-estate company which has several branches throughout the United States. The first step is to organize the information given about company. We have collected the following data:

Each branch has a unique branch number. It allocated staff, which includes one Manager. Also, each branch has a list of available houses to rent/sell.

The manager is responsible for the day-to-day running of a given branch.

Each staff has a unique staff number, name, position, salary, and branch number.

Each house has a unique house number, address, rent cost, sell value, status, branch number.

The statue of a house indicates whether it is available for rent/sell. The branch number indicate which branch of the real-estate company can rent/sell the house.

A Customer has SSN, name, contract number, house number.

Each Contract has a unique contract number, type, date, branch number, and customer number.

If the type of a contract is rent, it will have a deposit, and rent cost, and lengths of contract. The length of a rent contract can be six months, one year or 2 years but costumers can extend their contract by signing a new contract.

Each contract extension has a unique extension number, the original contract number, and discount value.

If the contract type is "sell", it will have sell value.

Customers can issue a contract termination request. Each termination request has a unique request number, customer number, and termination cost.

Draw an ER diagram for this database. Make sure to indicate primary keys, cardinality constraints, weak entities (if any), and participation constraints. List any assumptions you make in the process. Hint: You may need an ISA hierarchy somewhere.

Translate the ER diagram in #1 into relational database tables (i.e. give the SQL DDL statements). Make sure that the translation captures key constraints (primary keys and foreign keys if applicable) and participation constraints in the ER diagram. Identify constraints, if any, that you are not able to capture.

Answers

Answer:

Below is the extended ER diagram of the given scenario. It has 6 main entities connected via 5 relationship .IS A hierarchy is used to Contract and its sub classes Rent and Sell. Each entity has certain set of attributes and primary key is shown using underlined attribute.

Cardinality is shown using crow's feet notation.

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: input1.txt ammoniated millennium and the contents of input1.txt are: aspiration classified federation graduation millennium philosophy quadratics transcript wilderness zoologists the output is: aspiration classified federation graduation millennium

Answers

Answer:

Python code explained below

Explanation:

f = open(input())

#loading the file, which will serve as the input

s1 = input()  

s2 = input()

lines = f.readlines()

for line in lines:

   line = line.strip(

# strip() removes characters from both left and right

   if s1 <= line <= s2:  #setting the range

       print(line)

f.close()

#closing the file

```python

def main():

   # Read input file name and search range bounds

   file_name = input("Enter the name of the input file: ")

   lower_bound = input("Enter the lower bound of the search range: ")

   upper_bound = input("Enter the upper bound of the search range: ")

   # Open and read the contents of the input file

   with open(file_name, 'r') as file:

       lines = file.readlines()

   # Iterate over each line and check if it falls within the search range

   for line in lines:

       string = line.strip()  # Remove leading/trailing whitespace

       if lower_bound <= string <= upper_bound:

           print(string)

if __name__ == "__main__":

   main()

```

1. User Input:

  - The program prompts the user to enter the name of the input file (`file_name`) and the lower (`lower_bound`) and upper (`upper_bound`) bounds of the search range.

2. Reading the Input File:

  - It uses the `open()` function with the `'r'` mode to open the input file in read mode.

  - The `readlines()` method reads all lines from the file and stores them as a list of strings (`lines`).

3. Iterating Over Each Line:

  - It iterates through each line in the `lines` list using a `for` loop.

  - For each line, leading and trailing whitespace is removed using the `strip()` method to obtain the actual string (`string`).

4. Checking for Strings within the Range:

  - It compares each `string` with the `lower_bound` and `upper_bound` using the `<=` and `>=` operators to check if it falls within the specified range.

  - If a `string` is within the range (inclusive of the bounds), it is printed as output using the `print()` function.

5. Main Function:

  - The `main()` function is defined to encapsulate the main logic of the program.

  - It calls the `main()` function at the end to execute the program when it is run as a standalone script.

Overall, this program allows users to input a file name and search range, reads the contents of the input file, and outputs the strings that fall within the specified range.

Create a Java programming example of passing a name and age to a method. in the Main method, create variables for name and age. use the Scanner class to input the name and then the age. create a method called displayNameAge. pass the name and age to the method. display --"The name is _" -- "The age is ____" from the method. example: -"The name is Tom" "The age is 15"

Answers

Answer:

import java.util.Scanner;

public class num14 {

   public static void main(String[] args) {

       Scanner input = new Scanner(System.in);

       System.out.println("Enter a Name");

       String name = input.next();

       System.out.println("Enter the age");

       int age = input.nextInt();

       //Calling the Method

       displayNameAge(name,age);

   }

   public static void displayNameAge(String name, int age){

       System.out.println("The name is "+name+". The age is "+ age);

   }

}

Explanation:

Using Java Programming language:

Firstly create a method called displayNameAge() That accepts two parameter a string for name and an int for ageThe method uses string concatenation to produce the required outputIn a main method the scanner class is used to prompt user to enter values for name and age. These are stored in two seperate variableThe method  displayNameAge() is then called and passed these values as arguments.

Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicating the number of integers that follow. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain fewer than 20 integers.

Answers

Answer:

The program to this question can be described as follows:

Program:

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

int main() //defining main method

{

const int total_number= 20; //defining integer constant variable

int a[total_number],i; //defining integer array and variable  

printf("Enter total number, that you want to insert in list: "); //message  

scanf("%d",&a[0]); //input value by user

printf("Input list: "); //message

for(i=1;i<=a[0];i++) // loop for input value

{

scanf("%d",&a[i]); //input value by user

}

printf("List in reverse order:\n");

for(i=a[0];i>0;i--) //loop for print list in reverse order

{

printf("%d ",a[i]); //print value

}

return 0;

}

Output:

Enter total number, that you want to insert in list: 5

Input list: 6

4

2

8

1

List in reverse order:

1 8 2 4 6  

Explanation:

In the above C language program, three integer variable "total_number, a[], and i " is declared, in which total_number is a constant variable, that holds value 20, which is passed in an array, in array first element we input the total number of the list.

In the next step, an array variable is used, that uses for loop to input number in list.  Then another for loop is declared that prints the array value in its reverse order, with a white space.

We begin with a computer implemented in single-cycle implementation. When the stages are split by functionality, the stages do not require exactly the same amount of time. The original machine had a clock cycle time of 7 ns. After the stages were split, the measured times were IF, 1 ns; ID, 1.5 ns; EX, 1 ns; MEM, 2 ns; and WB, 1.5 ns. The pipeline register delay is 0.1 ns.

a. What is the clock cycle time of the 5-stage pipelined machine?
b. If there is a stall every 4 instructions, what is the CPI of the new ?machine?
c. What is the speedup of the pipelined machine over the single- cycle machine?
d. If the pipelined machine had an infinite number of stages, what would its speedup be over the single-cycle machine?

Answers

Answer:

a) First, we need to determine the pipeline stage amounting to the maximum time. In the given case, the maximum time required is 2ns for MEM. In addition, the pipeline register delay=0.1 ns.

Clock cycled time of the pipelined machine= max time+delay

=2ns+0.1 ns

=2.1 ns

b) For any processor, ideal CPI=1. However, since there is a stall after every four instructions, the effective CPI of the new machine is specified by:

[tex]1+(1 / 4)=1.25[/tex]

c) The speedup of pipelined machine over the single-cycle machine=avg time per instruction of single cycle/avg time per instruction of pipelined.

Single cycle processor:

CPI=1

Clock period=7 ns

Pipelined processor:

Clock period=2.1 ns

CPI=1.25

Therefore, speedup=[tex]=7^{*} 1 /\left(2.1^{*} 1.25\right)[/tex]

=7/2.625

= 2.67

d) As the number of stages approach infinity, the speedup=k where k is the number of stages in the machine.

The PRNG variable ___________ is defined in NIST SP 800-90 as a number associated with the amount of work required to break a cryptographic algorithm or system.

Answers

Answer:

Strength

Explanation:

A huge number of systems use a process called Pseudo Random Number Generation (PRNG). In NIST SP 800-90, The PRNG has a set of parameters that define various variables within the algorithm. The PRNG variable strength is defined in NIST SP 800-90 as a number associated with the amount of work required to break a cryptographic algorithm or system.

Which part of the operating system enables you to interact with the device? Question 9 options: The graphical user interface The utilities The platform The software as a service

Answers

Answer: The graphical user interface

Explanation:

The graphical user interface (GUI) is a form of user interface that allows user of a device interacts with it through graphical icons or cursors, text based commands or audio commands. The functionality of a GUI is a consequence of the direct manipulation of its graphical elements. Specialized GUIs that allows for speech based commands are called natural user interfaces.

Fullsoft, Inc. is a software development company based in New York City. Fullsoft’s software product development code is kept confidential in an effort to safeguard the company’s competitive advantage in the marketplace. Fullsoft recently experienced a malware attack; as a result, proprietary information was leaked. The company is now in the process of recovering from this breach.

You are a security professional who reports into Fullsoft’s infrastructure operations team. The chief technology officer (CTO) asks you and your colleagues to participate in a team meeting to discuss the incident and its potential impact on the company.

Tasks

1. Prepare for the meeting by deliberating on the following questions:

What circumstances may have allowed this incident to occur, or could allow a similar incident to occur in the future?

What insights about risks, threats, and/or vulnerabilities can you glean from reports of similar incidents that have occurred in other organizations?

What potential outcomes should the company anticipate as a result of the malware attack and possible exposure of intellectual property?

Which countermeasures would you recommend the company implement to detect current vulnerabilities, respond to the effects of this and other successful attacks, and prevent future incidents?

2. Write an outline of key points related to the questions above that the team should discuss at the meeting.

Self-Assessment Checklist

I created an outline that describes key points the team should discuss at the meeting. My outline describes:

Circumstances that may have allowed the malware infection to occur, or could allow a similar incident to occur in the future

Insights about risks, threats, and/or vulnerabilities from reports of similar incidents that have occurred in other organizations

Potential outcomes of a malware attack and exposure of confidential information

Countermeasures the company should implement

Answers

Answer:

1. This event can occur because:

exchanging file folders utilizing USB transmission of false ant viruses fake codec emails through your app browsing infected websites installing infected software etc.

2.

The worst that will happen with such an event is:

key-logger: program capable of capturing and recording keystrokes from users. Backdoor: Tool secret to circumvent desktop workstation encryption programs. Zombie: internet-connected device which has been hacked. Denial-of-service attack (DOS attack): effort to unavail a computer resource

3.  

It robs private information including email accounts, phone numbers, credit card numbers, etc. This removes the files, or changes them. Tries to steal the identification numbers for the device and uses our machines as relays.

4.

Use up-to-date antivirus that constantly analyzes your system's actions. Create a great malware scanner to evaluate the actions of the software to detect changes through using sandbox testing hash algorithm methods. Change your passwords often. Should not open any unwanted attachments to e-mail. Watch out for pop-up windows which ask you to download something (such as anti-virus software) when you just browse the internet. Maintain up-to-date program. Newer systems auto-update. Firewall: program that inspects transiting network traffic and refuses or permits transit based on a set of guidelines.

5.

Key points outline:

malware circumstances. Insights on risks and/or vulnerabilities. Possible consequences, and possible intellectual property publicity. Anti-vulnerability countermeasure

Write an x64 MASM program using ReadConsoleA and WriteConsoleA to prompt the user for their name. The program should then display the user's name surrounded by asterisks. Allow the name to be up to 30 characters long. Example (user input is boldface, and there are 28 asterisks on the top and bottom lines): What is your name?

Answers

Solution:

The following program will be run using Read Console A and Write Console A and it also displays the name of the user surrounded by asterisks

# include <iostream>

# include <cstring>

using namespace std;

int main(){

               char name[31];

               cout <<"What is your name? ";

               cin.getline(name,30,'\n');

               for(int i=1; i<=30 ; i++){

                               cout<<"*";

               }

               int spaces = 30 - strlen(name)-1;

               cout<<endl<<"*"<<name;

               for(int space=1; space<spaces; space++){

                               cout<<" ";

               }

               cout<<"*"<<endl;

               for(int i=1; i<=30 ; i++){

                               cout<<"*";

               }

              return 0

}

An x64 MASM program can prompt the user for their name and display it surrounded by asterisks using ReadConsoleA and WriteConsoleA. The program handles up to 30-character names and includes a formatted code example. Follow the outlined steps to implement the program.

x64 MASM Program to Prompt and Display User Name

Below is an example of an x64 MASM program using ReadConsoleA and WriteConsoleA to prompt the user for their name and display it surrounded by asterisks. The program allows for a name up to 30 characters long.

Step-by-Step Breakdown

Firstly, initialize the necessary libraries and define constants, such as buffer sizes and error codes.

Set up buffers for input and output operations. For this example, a 32-byte input buffer (30 characters + 2 for ' ') is used.

Prompt the user for their name using WriteConsoleA.

Capture input from the user using ReadConsoleA into the buffer.

Format the name display by surrounding it with asterisks, and use WriteConsoleA again to display the formatted output.

MASM Code Example

Here is a sample x64 MASM code snippet to achieve the described functionality:

INCLUDE Irvine64.inc

.DATA

   prompt BYTE "What is your name?", 0

   buffer BYTE 32 DUP(0)

   output BYTE 64 DUP(0)

.CODE

main PROC

   ; Display the prompt

   mov rdx, OFFSET prompt

   call WriteConsoleA

   ; Read user input

   mov rdx, OFFSET buffer

   mov rcx, 32

   call ReadConsoleA

   ; Prepare the output string

   mov rdx, OFFSET buffer

   call StripCrLf  ; Remove the trailing CR+LF

   mov rbx, OFFSET buffer

   mov rcx, OFFSET output

   call FormatOutput ; Surround input with asterisks

   ; Display the formatted name

   mov rdx, OFFSET output

   call WriteConsoleA

   exit

main ENDP

END main

The above code includes steps to prompt the user, read their input, and display it within a decorative format. Modify the logic within the FormatOutput function to suit the exact formatting needs.

A compound containing only C, H, and O, was extracted from the bark of the sassafras tree. The combustion of 81.7 mg produced 222 mg of CO2 and 45.4 mg of H2O. The molar mass of the compound was 162 g/mol. Determine its empirical and molecular formulas.

Answers

Answer:

Empirical formula= C4H20

Molecular formula = C8H4O2

Explanation:

It is given that 81.7 mg produced 222 mg of CO2 and 45.4 mg of H2O.

Note:Molar mass of C = 12g/mol

Molar mass of CO2 = 44g/mol

Therefore mass of C in 222mg of CO2= 12/44*(0.222)

=0.0605g

Note: Molar mass of H=1g/mol

Molar mass of H2O=18g/mil

Therefore, mass of H in 45.4mg of H2O= 1/18*(0.0454)

=0.0025g

Therefore, Mass of O = 0.0817-0.0025-0.0605

=0.0187g

Divide through by the atomic mass:

C=0.0605/12=0.00504

H=0.002/1=0.002

O=0.0187/16=0.00117

Divide through by the smallest number

C=0.00504/0.00117 = 4.3 ; Approx 4

H=0.002/0.00117=1.7 ; Approx 2

O=0.00117/0.00117=1

The empirical formula= C4H20

To calculate Molecular formula, (C4H20)n = 162

((12*4)+(1*2)+16)n=162

66n=162

n=162/66=2.45 ; Approx 2

Molecular formula = C8H4O2

In cell G8 in the Summary worksheet, insert a date function to calculate the number of years between 1/1/2018 in cell H2 and the last remodel date in the Last Remodel column (cell F8). Use relative and mixed references correctly. Copy the function to the range G9:G57. Unit 101 was last remodeled 13.75 years ago. Ensure that the function you use displays that result. g

Answers

Answer:

The cell G8 in the summary worksheet can be filled with the help of the date function (YEARFRAC) as follows:

The required formula to calculate the number of years between cell H2 and last remodel date in the Last Remodel column cell F8 is given as follows:

G8 =YEARFRAC($H$2,F8)

The above formula will return value 13.75 into the cell G8. The sample result is shown as follows in the images attached,

Write a program trapezoid.cpp that prints an upside-down trapezoid of given width and height. However, if the input height is impossibly large for the given width, then the program should report,

Answers

Final answer:

The question pertains to writing a C++ program to print an upside-down trapezoid or report an error if the input height is impossible for the given width. An example code snippet demonstrates basic logic using loops to print the trapezoid shape. It includes error handling for when the input height is too large.

Explanation:

You asked how to write a program trapezoid.cpp that prints an upside-down trapezoid of given width and height, or reports an error if the height is impossibly large for the given width. The subject of this question falls under Computers and Technology, particularly involving programming skills. Let's assume you are going to use C++ for this task since the file extension is .cpp.

Here is an example of how you could approach this problem:

\#include <iostream>
using namespace std;

int main() {
   int width, height;
   cout << "Enter width and height of the trapezoid: ";
   cin >> width >> height;

   if (height > (width+1)/2) {
       cout << "Error: The height is too large for the given width." << endl;
   } else {
       for (int row = 0; row < height; row++) {
           for (int i = 0; i < row; i++)
               cout << " ";
           for (int i = 0; i < width - 2*row; i++)
               cout << "*";
           cout << endl;
       }
   }
   return 0;
}

This example C++ program checks if the height is too large and if it's not, it proceeds to print the upside-down trapezoid.

This program prints an upside-down trapezoid of a given width and height using C++. It first checks if the given height is possible for the given width, and prints an error message if it is not.

Program to Print an Upside-Down Trapezoid

Here is a simple C++ program to print an upside-down trapezoid of given width and height. If the input height is too large compared to the width, the program should report that the input size is impossible.

Steps:

Read inputs for width and height.Check if the height is possible given the width.Print the trapezoid if possible, else report an error.

Here is the C++ code for the program:

#include <iostream>
using namespace std;
int main() {
   int width, height;
   cout << "Enter width: ";
   cin >> width;
   cout << "Enter height: ";
   cin >> height;
   if (height > (width + 1) / 2) {
       cout << "Impossible shape!" << endl;
       return 1;
   }
   for (int i = 0; i < height; ++i) {
       for (int j = 0; j < i; ++j) {
           cout << " ";
       }
       for (int k = 0; k < width - 2 * i; ++k) {
           cout << "*";
       }
       cout << endl;
   }
   return 0;
}

The class shown below called is called CSVReader. Use this class exactly as it is written (specifically don’t add any instance variables) except add the code for the methods readFile, numberOfRows, numberOfFields, and field. Not that this class stores the data in a 2-dimensional ArrayList of String. You can assume that the fields in a CSV file are separated by commas. You will find it useful to have a Scanner object that reads the file line by line, and a second Scanner object that processes each line.

import java.util.Scanner;
import java.util.ArrayList;
import java.io.File;
import java.io.FileNotFoundException;

public class CSVReader
{
ArrayList> fields;
public CSVReader()
{
fields = new ArrayList>();
}
public void readFile(String filename) throws FileNotFoundException
{
File inputFile = new File (filename);
String word;
String line;
int index = 0;
Scanner in = new Scanner(inputFile);
while(in.hasNextLine())
{
line = in.nextLine();
Scanner lineScanner = new Scanner(line);
lineScanner.useDelimiter(",");
fields.add(new ArrayList());
while(lineScanner.hasNext())
{
word = lineScanner.next();
fields.get(index).add(word);
}
lineScanner.close();
index++;
}
in.close();
}
public int numberOfRows()
{
return fields.size();
}
public int numberOfFields(int row)
{
if(row < 0) {return 0;}
if(row >= fields.size()){return 0;}
return fields.get(row).size();
}
String field(int row, int column)
{
if( row >= 0 && row < fields.size()){
if(column >= 0 && column < fields.size())
{
return fields.get(row).get(column);
}
else return "";
}
else return "";
}
}

Note: Your program should ignore the first row of data (which is the column headers) even though your CSVReader class will read and store these values.
• You can assume that the names of the realtors in Realty.csv consist of a single-word first name followed by one blank followed by a single-word last name.
• The MLS number should be left justified in a field 8 characters wide
• The name should be written as Lastname, Firstname left justified in a field 20 characters wide
• The street address should be left justified in a field 20 characters wide
• The city should be left-justified in a field 12 characters wide
• The state should be left justified in a field 3 characters wide
• The zip should be left justified in a field 6 characters wide
• The price should be right justified in a field 12 characters wide, preceded by a dollar sign, with decimal separators and 2 digits of precision.
• The square footage, number of bedrooms, number of baths, and price per square foot should look like the example, with price per square foot right justified.
Include the summary information at the bottom.
M5678 Smith, Jane 606 Cardinal St. Maryville TN 37803 $230,000.00 1800 SF 4 beds 2 baths price/sf: $127.78

M3499 McCormick, Lance 418 Scenic Dr. Knoxville TN 37919 $649,000.00 3900 SF 4 beds 4 baths price/sf: $166.41
M2345 Smith, Jane 814 St. Andrew St. La Crosse WI 54601 $99,000.00 1100 SF 2 beds 1 baths price/sf: $90.00
M1265 Finley, Heather 517 Avon St. La Crosse WI 54601 $110,000.00 1200 SF 3 beds 1 baths price/SF: $91.67
M8690 Burmeister, Georgia 728 Alice Bell Rd Knoxville TN 37917 $169,000.00 2100 SF 3 beds 2 baths price/sf: $80.48
M8356 Nichols, Roger 119 Cherokee Blvd Knoxville TN 37919 $999,999.00 3800 SF 5 beds 4 baths price/sf: $263.16
M8211 Jones, Steven 619 Derby St Chattanooga TN 37404 $549,000.00 2800 SF 4 beds 3 baths price/sf: $196.07
M8044 Smith, Harold 872 La Crosse St. La Crosse WI 54603 $210,000.00 2250 SF 3 beds 2 baths price/sf: $93.33
M4789 O'Connor, Judy 4000 McArthur Ave Chattanooga TN 37404 $179,000.00 1675 SF 3 beds 3 baths price/sf: $106.87
M9000 Smith, Alice 1901 3rd St. Chattanooga TN 37411 $158,000.00 2400 SF 3 beds 3 baths price/sf: $65.83
There is a total of 10 homes on the market with an average price of $335,299.90

Using the class provided above make a Tester method that prints out the file provided Realty.csv as well as making sure other files like Realty.csv can also be used in the Tester made us the Class provided. Make it to where any CSV file can be used by hardcoding it in but for this question only focus on the file shown
CSV File contents:
MLS Realtor name Street Address City State Zip Price square footage number of bedrooms number of bathrooms
M5678 Jane Smith 606 Cardinal St. Maryville TN 37803 230000 1800 4 2
M3499 Lance McCormick 418 Scenic Dr. Knoxville TN 37919 649000 3900 4 4
M2345 Jane Smith 814 St. Andrew St. La Crosse WI 54601 99000 1100 2 1
M1265 Heather Finley 517 Avon St. La Crosse WI 54601 110000 1200 3 1
M8690 Georgia Burmeister 728 Alice Bell Rd Knoxville TN 37917 169000 2100 3 2
M8356 Roger Nichols 119 Cherokee Blvd Knoxville TN 37919 999999 3800 5 4
M8211 Steven Jones 619 Derby St Chattanooga TN 37404 549000 2800 4 3
M8044 Harold Smith 872 La Crosse St. La Crosse WI 54603 210000 2250 3 2
M4789 Judy O'Connor 4000 McArthur Ave Chattanooga TN 37404 179000 1675 3 3
M9000 Alice Smith 1901 3rd St. Chattanooga TN 37411 158000 2400 3 3

Answers

Answer:

import java.io.File;

import java.io.FileNotFoundException;

import java.util.ArrayList;

import java.util.Scanner;

public class CSVReader {

  ArrayList fields;

  public CSVReader() {

      fields = new ArrayList();

  }

  public void readFile(String filename) throws FileNotFoundException {

      File inputFile = new File(filename);

      String word;

      String line;

      int index = 0;

      int ind2 = 0;

      int valPrice = 0, valSqft = 0, valSum = 0;

      Scanner in = new Scanner(inputFile);

      while (in.hasNextLine()) {

          line = in.nextLine();

          Scanner lineScanner = new Scanner(line);

          lineScanner.useDelimiter(",");

          fields.add(new ArrayList());

          while (lineScanner.hasNext()) {

              word = lineScanner.next();

              if (index != 0) {

                  if (ind2 == 2) {

                      System.out.print(", " + word);

                  } else if (ind2 == 8) {

                      System.out.printf(" $" + Integer.valueOf(word) / 1000);

                      if (Integer.valueOf(word) % 1000 > 0) {

                          System.out.printf(",%.2f", (float) Integer.valueOf(word) % 1000);

                      } else {

                          System.out.print(",000.00");

                      }

                      valPrice = Integer.valueOf(word);

                      valSum += Integer.valueOf(word);

                  } else if (ind2 == 9) {

                      System.out.print(" SF " + word);

                      valSqft = Integer.valueOf(word);

                  } else if (ind2 == 11) {

                      System.out.print(" beds " + word);

                      System.out.printf(" baths price/sf: $ %.2f\n", (float) valPrice / valSqft);

                  } else if (ind2 > 0) {

                      System.out.print(" " + word);

                  } else if (ind2 == 0) {

                      System.out.print(word);

                  }

              }

              ((ArrayList) fields.get(index)).add(word);

              ind2++;

          }

          lineScanner.close();

          index++;

          ind2 = 0;

          valPrice = 0;

          valSqft = 0;

      }

      System.out.printf(

              "There is a total of " + (numberOfRows() - 1) + " homes on the market with an average price of $"+(valSum / (numberOfRows() - 1))/1000+",%.2f",

              (float) (valSum / (numberOfRows() - 1))%1000);

      in.close();

  }

  public int numberOfRows() {

      return fields.size();

  }

  public int numberOfFields(int row) {

      if (row < 0) {

          return 0;

      }

      if (row >= fields.size()) {

          return 0;

      }

      return ((ArrayList) fields.get(row)).size();

  }

  String field(int row, int column) {

      if (row >= 0 && row < fields.size()) {

          if (column >= 0 && column < fields.size()) {

              return (String) ((ArrayList) fields.get(row)).get(column);

          } else

              return "";

      } else

          return "";

  }

  public static void main(String[] args) throws FileNotFoundException {

      CSVReader test = new CSVReader();

      test.readFile("R.csv");

  }

}

Explanation:

Other Questions
At the end of a project, what files should be kept for archiving?Select all that apply.A)edited imagesB)client copyC)RAW photosD) native files Arithmetic number sequence definition describe the relationship between the direction of the velocity vector and the direction of the acceleration for a body moving in a circle at constant speed (A) In some cases, neither of the two equations in the system will contain a variable with a coefficient of 1, so we must take a further step to isolate it. Let's say we now have:3C+4D=52C+5D=2None of these terms has a coefficient of 1. Instead, we'll pick the variable with the smallest coefficient and isolate it. Move the term with the lowest coefficient so that it's alone on one side of its equation, then divide by the coefficient.(B) Now that you have one of the two variables in Part (A) isolated, use substitution to solve for the two variables. You may want to review the Multiplication and Division of Fractions and Simplifying an Expression Primers.. A Karissa le gusta la pelota. Is the sentence written correctly Stephen is preparing his pitch for a bank representative that will be considering him for a business loan. He lists the resumes and credentials of chefs who are working in the restaurants kitchen. This is an example of what marketing principle (from the 7 Ps)? Before President Truman authorized the use of the atomic bomb on Japan, what were the most likely concerns he faced inmaking his decision? Select two options.the approval of Congress to use the bombthe death of innocent Japanese people if he used the bombthe effect on his reelection bid and his legacy if he used the bombthe death of many US soldiers in further fighting if he did not use the bombthe continuation of the war if Japan would not surrender if he did not use the bomb Suppose that two factors have been identified for the U.S. economy: the growth rate of industrial production, IP, and the inflation rate, IR. IP is expected to be 5%, and IR 3.0%. A stock with a beta of 2.6 on IP and 1.9 on IR currently is expected to provide a rate of return of 13%. If industrial production actually grows by 7%, while the inflation rate turns out to be 6.0%, what is your revised estimate of the expected rate of return on the stock? 2 UO2+ + 4 H+U4+ + UO22+ + 2 H2O is second order in UO2+ and third order overall. Complete the rate law for this reaction in the box below. Use the form k[A]m[B]n... , where '1' is understood for m, n ... (don't enter 1) and concentrations taken to the zero power do not appear Two similar rodent species are consistently more different from each other when they occupy the same habitat than when they live separately. What is the most likely explanation for the increased divergence when they live together t physiological pH, the carboxylic acid group of an amino acid will be ________, while the amino group will be ________, yielding the zwitterion form. Some scientific explanations are so well established that no new evidence is likely to alter them. The explanation becomes a scientific theory. In everyday language a theory means a hunch or speculation. Not so in science. In science, the word theory refers to a comprehensive explanation of an important feature of nature supported by facts gathered over time. Theories also allow scientists to make predictions about as yet unobserved phenomena.A scientific theory is a well-substantiated explanation of some aspect of the natural world, based on a body of facts that have been repeatedly confirmed through observation and experimentation. Such fact-supported theories are not "guesses" but reliable accounts of the real world. The theory of biological evolution is more than "just a theory." It is as factual an explanation of the universe as the atomic theory of matter (stating that everything is made of atoms) or the germ theory of disease (which states that many diseases are caused by germs). Our understanding of gravity is still a work in progress. But the phenomenon of gravity, like evolution, is an accepted fact.Not some key features of theories that are important to understand from this description:A. Theories are explanations of natural phenomenon. They aren't predictions (although we may use theories to make predictions). They are explanations why we observe something.B. Theories aren't likely to change. They have so much support and are able to explain satisfactorily so many observations, that they are not likely to change. Theories can, indeed, be facts. Theories can change, but it is a long and difficult process. In order for a theory to change, there must be many observations or evidence that the theory cannot explain.C. Theories are not guesses. The phrase "just a theory" has no room in science. To be a scientific theory carries a lot of weight; it is not just one person's idea about something. a 250 word essay on what you think the government could do to improve one the nation's economy With this diagram, what could be the values of c and d? The triangles shown are similar. Find MV. You want to acquire a graphic design project. Describe how you will exhibit your public relations skills and interact with the client to acquire the project. Viruses can vary with respect to all of the following characteristics except _____. the type of host cell it can infect DNA or RNA as the genetic material single- or double-stranded nucleic acids the presence or absence of a membranous envelope the presence or absence of metabolic machinery Recently, a famous news channel broadcasted that their country experienced the lowest rate of unemployment in the last ten years. This made the viewers feel optimistic. In this scenario, the media outlet was able to influence the viewers' opinions with a technique called _____. A series RL circuit includes a 6.05 V 6.05 V battery, a resistance of R = 0.655 , R=0.655 , and an inductance of L = 2.55 H. L=2.55 H. What is the induced emf 1.43 s 1.43 s after the circuit has been closed? Which sentence quotes a research source correctly?A)Although most scientists agree on the amount of funding needed for the experiMent, a few "wildly and vehemently disagree"B)Although most scientists agree on the amount of funding needed for the experiment, a few "wildly and vehemently disagree." (74).C)Although most scientists agree on the amount of funding needed for the experiment, a few "wildly and vehemently disagree" (Radel)D)Although most scientists agree on the amount of funding needed for the experiment, a few "wildly and vehemently disagree" (Radel, page 74).