Privacy laws in other countries are an important concern when performing cloud forensics and investigations. You've been assigned a case involving PII data stored on a cloud in Australia. Before you start any data acquisition from this cloud, you need to research what you can access under Australian law. For this project, look for information on Australia's Privacy Principles (APP), particularly Chapter 8: APP 8 – Cross-border disclosure of personal information. Write a 2 to 3 page paper (not including title and reference pages) using APA format summarizing disclosure requirements for getting consent from data owners, and any exceptions allowed by this law. Writing Requirements

Answers

Answer 1

Answer:

See the explanation for the answer.

Explanation:

Australian regulations makes extremely difficult for the enterprises to move organizations sensitive data to the cloud which is storing outside the Australian network. These are all managed by the Office of Australian Information Commissioner(OAIC) which provides oversight on the data privacy regulations designed to govern the dissemination of the sensitive information.

One rule they applied under this is The Australian National Privacy Act 1988 which tells how the organizations collect, use, secure, store the information. The National Privacy Principles in the Act tells how organizations should use the people's personal information. The NPP has a rule that An organization must take the responsibility to hold the information without misuse or modified by unauthorized access. They require enterprises to put security service level agreements with the cloud service providers that define audit rights, data location, access rights when there is cross border disclosure of information.

In later time they introduced a new principle called The Privacy Amendment Act 2012. This principle gives set of new rules along with the changes in the many rules in the previous act and also this is having a set of new principles those are called Australian Privacy Principles (APP).

In this there is principle for cross border disclosure of personal information which is APP8. This rule regulates the disclosure or transfer of personal information by an agency or company to a different location outside the country.

Before disclosure the information outside they have to take responsible steps that the company outside the Australia must not breach the APP 's.


Related Questions

Write a C translation of the NASM program below, sticking to the assembly code as much as possible. Use single-letter variable names for function parameters (e.g., int foo(int x, int y)) and for local variables within function (e.g., int z) instead of using x86 register names (in fact registers should never appear in your translation). It is expected that your C code is much shorter than the assembly code.

Answers

The request from the student entails translating NASM assembly code into equivalent C code, a task typically associated with understanding computer programming languages and their conversion among the various levels of abstraction. Given the lack of actual NASM code in the question, a direct translation cannot be provided. However, explanations of assembly and machine languages, key elements of computer architecture, can be discussed as part of the educative process.

The Final answer would ordinarily consist of the translated C code, but due to the absence of specific assembly code, this cannot be provided. The

should focus on educating about the differences between assembly language and machine language, the process of translating between them, and the significance of this exercise in the realm of MIPS Assembly architecture.

Banks have many different types of accounts often with different rules for fees associated with transactions such as withdrawals. Customers can transfer funds between accounts incurring the appropriate fees associated with withdrawal of funds from one account.Write a program with a base class for a bank account and two derived classes as described belowrepresenting accounts with different rules for withdrawing funds. Also write a function that transfers funds from one account of any type to anotheraccount of any type.A transfer is a withdrawal from one accountand a deposit into the other.

Answers

Answer:

See explaination

Explanation:

// Defination of MoneyMarketAccount CLASS

MoneyMarketAccount::MoneyMarketAccount(string name, double balance)

{

acctName = name;

acctBalance = balance;

}

int MoneyMarketAccount::getNumWithdrawals() const

{

return numWithdrawals;

}

int MoneyMarketAccount::withdraw(double amt)

{

if (amt < 0)

{

cout << "Attempt to withdraw negative amount - program terminated."<< endl;

exit(1);

}

if((numWithdrawals < FREE_WITHDRAWALS) && (amt <= acctBalance)){

acctBalance = acctBalance - amt;

return OK;

}

if((numWithdrawals >= FREE_WITHDRAWALS) &&((amt + WITHDRAWAL_FEE) <= acctBalance)){

acctBalance = acctBalance - (amt + WITHDRAWAL_FEE);

return OK;

}

return INSUFFICIENT_FUNDS;

}

// Defination of CDAccount CLASS

CDAccount::CDAccount(string name, double balance, double rate)

{

acctName = name;

acctBalance = balance;

interestRate = rate/100.0;

}

int CDAccount::withdraw(double amt)

{

if (amt < 0)

{

cout << "Attempt to withdraw negative amount - program terminated."<< endl;

exit(1);

}

double penalty = (PENALTY*interestRate*acctBalance);

if((amt + penalty) <= acctBalance){

acctBalance = acctBalance - (amt + penalty);

return OK:

}

else

return INSUFFICIENT_FUNDS;

}

void transfer (double amt, BankAccount& fromAcct, BankAccount& toAcct)

{

if (amt < 0 || fromAcct.acctBalance < 0 || toAcct < 0)

{

cout << "Attempt to transfer negative amount - program terminated."<< endl;

exit(1);

}

if(fromAcct.withdraw(amt) == OK){ // if withdraw function on fromAcct return OK, then me can withdraw amt from fromAcct

// and deposit in toAcct

toAcct.acctBalance = toAcct.acctBalance + amt;

}

}

. Write a toString method for this class. The method should return a string containing the base, height and area of the triangle. b. Write an equals method for this class. The method should accept a Triangle object as an argument. It should return true if the argument object contains the same data as the calling object, or false otherwise. c. Write a greaterThan method for this class. The method should accept a Triangle object as an argument. It should return true if the argument object has an area that is greater than the area of the calling object, or false otherwise.

Answers

Answer:

Check the explanation

Explanation:

Circle.java

public class Circle {

private double radius;

public Circle(double r) {

radius = r;

}

public double getArea() {

return Math.PI * radius * radius;

}

public double getRadius() {

return radius;

}

public String toString() {

String str;

str = "Radius: " + radius + "Area: " + getArea();

return str;

}

public boolean equals(Circle c) {

boolean status;

if (c.getRadius() == radius)

status = true;

else

status = false;

return status;

}

public boolean greaterThan(Circle c) {

boolean status;

if (c.getArea() > getArea())

status = true;

else

status = false;

return status;

}

}

I have created a class also to test this class below is the class: -

MainCircle.java

public class MainCircle {

public static void main(String args[]) {

Circle c = new Circle(2.5);

Circle c1 = new Circle(2.5);

Circle c2 = new Circle(4.5);

System.out.println(c);

System.out.println(c1);

System.out.println(c2);

System.out.println("Is c and c1 equal : "+c.equals(c1));

System.out.println("Is c2 greater than c1 : "+c1.greaterThan(c2));

}

}

Output: -

Radius: 2.5Area: 19.634954084936208

Radius: 2.5Area: 19.634954084936208

Radius: 4.5Area: 63.61725123519331

Is c and c1 equal : true

Is c2 greater than c1 : true

The American Standard Code for Information Interchange (ASCII) has 128 binary-coded characters. A certain computer generates data at 1,000,000 characters per second. For single error detection, an additional bit (parity bit) is added to the code of each character. What is the minimum bandwidth required to transmit this signal.

Answers

Final answer:

The minimum bandwidth required to transmit a signal generated at a rate of 1,000,000 ASCII characters per second, with an added parity bit for single error detection, is 4 MHz. This calculation is based on the bit rate of 8 million bits per second and assumes a binary signal requiring a minimum bandwidth that is half of the bit rate.

Explanation:

The question pertains to digital data transmission and requires calculating the minimum bandwidth necessary for a computer that generates data at a rate of 1,000,000 characters per second, using ASCII which has 7-bit binary-coded characters and includes an additional parity bit for error detection, making it 8 bits per character in total.

Bandwidth, in this context, refers to the range of frequencies necessary to transmit the digital signal. The data rate of the signal is given as 1,000,000 characters per second, and since each character is represented by 8 bits (7 bits for ASCII character and 1 for parity), the bit rate is 8,000,000 bits per second, or 8 Mbps (Megabits per second).

To calculate the minimum bandwidth using the Nyquist formula, we assume the signal is binary and requires a minimum bandwidth that is half of the bit rate. Hence, the minimum bandwidth required is 4 MHz (megahertz). This is because the maximum rate of change of a binary signal would be if it alternated between 0 and 1 for every bit, so the minimum bandwidth is also known as the Nyquist bandwidth.

Final answer:

The minimum bandwidth required to transmit ASCII characters with single error detection at 1,000,000 characters per second, assuming a parity bit is added to each character, is 8 Mbps. This figure is based on 8-bit as characters and could vary depending on the modulation technique used.

Explanation:

The minimum bandwidth required to transmit a signal with single error detection for ASCII characters at a rate of 1,000,000 characters per second can be calculated considering the addition of a parity bit to each character. ASCII uses 7 bits per character, making it 8 bits with the parity bit. To find the bandwidth, we multiply the bit rate per character by the number of characters per second. Since the computer generates data at 1,000,000 characters per second, and with the parity bit, we have an 8-bit as character, the data rate becomes 8,000,000 bits per second (or 8 Mbps).

However, the bandwidth can also be affected by various factors such as the modulation technique used. For instance, if a simple binary modulation scheme is used (such as non-return-to-zero, NRZ), where one bit is transmitted per signal change, the bandwidth would be 8 Mbps. But if a more complex modulation scheme is used, which transmits more than one bit per signal change, the required bandwidth could be lower.

read_data Define a function named read_data with two parameters. The first parameter will be a csv reader object (e.g., the value returned when calling the function csv.reader) and the second parameter will be a list of strings representing the keys for this data. The list matches the order of data in the file, so the second parameter's first entry is the key to use for data in the file's first column, the second parameter's second entry is the key to use for data in the file's second column, and so on. The function's first parameter will be a csv reader object and not a string. This means you do not need the with..as nor create the csv reader in your function, but this will be done in the code calling your function. For example, to execute read_data using a file named "smallDataFileWithoutHeaders.csv" you would write the following code: with open("smallDataFileWithoutHeaders.csv") as f_in: csv_r = csv.reader(f_in) result = read_data(csv_r,['tow_date','tow_reason']) You would then want to include code to check that header had the expected value. The function should return a list of dictionaries. This list will contain a dictionary for each row read using the first parameter. The keys of these dictionaries will be the entries in the second parameter and the values will be the data read in from the file (you can assume there will be equal numbers list entries and columns).
For example, suppose the lines of the file being read by csv_r were:

2015-12-30,IL

2018-04-07,GA

then the call read_data(csv_r,['tow_date','tow_reason']) would need to return:

[{'tow_date': '2015-12-30', 'tow_reason': 'IL'},
{'tow_date': '2018-04-07', 'tow_reason': 'GA'}]

Answers

Answer:

Check the explanation

Explanation:

Given below is the code for the question. PLEASE MAKE SURE INDENTATION IS EXACTLY AS SHOWN IN IMAGE.

import csv

def read_data(csv_r, keys):

  data = []

  for row in csv_r:

      mydict = {}

      for i in range(len(keys)):

          mydict[keys[i]] = row[i]

      data.append(mydict)

  return data

SCREENSHOT:

Hex value 0xC29C3480 represents an IEEE-754 single-precision (32 bit) floating-point number. Work out the equivalent decimal number. Show all workings (e.g. converting exponent and mantissa)

Answers

Answer:

floating point Decimal Number  = -78.1025390625

Explanation:

Hex Value =0xC29C3480

Convert this hex value into binary number, Use only C29C3480 as hexadecimal number. Each digit in hexadecimal will convert into 4 bits of binary. To convert this number into decimal we use hexadecimal to binary table. The conversion is as below:

1100 0010 1001 1100 0011 0100 1000 0000

Now this is a 32 bit number in binary, the bits are arranged as follows

1                        10000101                       00111000011010010000000

(Sign bit)            (Exponent bits)                      (Fraction bits)

In this 32 bit number, 32nd bit is sign bit,number is positive if the bit is 0 other wise number is negative. From 31st to 23rd bits 8 bits that are known as exponent bits, while from 22nd to 0 total 23 bits that are called fraction bit.

As the 32 bit is 1, so given number is negative. Now convert the Exponent bits into decimal values as

10000101 = 1x2⁷+0x2⁶+0x2⁵+0x2⁴+0x2³+1x2²+0x2¹+1x2⁰

                = 1x2⁷ + 1x2² + 1x2⁰

                = 128 + 4 + 1 =  133

      3. Now we calculate the exponent bias, that will be calculated through, the formula.

       exponent bias = 2ⁿ⁻¹ - 1

there n is total number of bits in exponent value of 32 bit number, Now in this question n=8, because there are total 8 bits in exponent.

  so,       exponent bias = 2⁸⁻¹ - 1 = 2⁷-1= 128-1= 127

          e = decimal value of exponent - exponent bias

             =     133 - 127 = 6

       4. Now, we calculate the decimal value of fraction part of the number, which is called mantissa.

         Mantissa=0x2⁻¹+0x2⁻²+1x2⁻³+1x2⁻⁴+1x2⁻⁵+0x2⁻⁶+0x2⁻⁷+0x2⁻⁸+0x2⁻⁹+1x2⁻¹⁰+1x2⁻¹¹+0x2⁻¹²+1x2⁻¹³+0x2⁻¹⁴+0x2⁻¹⁵+1x2⁻¹⁶+0x2⁻¹⁷+0x2⁻¹⁸+0x2⁻¹⁹+0x2⁻²⁰+0x2⁻²¹+0x2⁻²²+0x2⁻²³

               = 1x2⁻³+1x2⁻⁴+1x2⁻⁵+1x2⁻¹⁰+1x2⁻¹¹+1x2⁻¹³+1x2⁻¹⁶

               =  0.125 + 0.0625 + 0.03125 + 0.0009765625 + 0.00048828125 +                     0.00012207031 + 0.00001525878

Mantissa = 0.22035217284

Now the formula to calculate the decimal number is given below:

decimal number = (-1)^s x (1+Mantissa) x 2^e

there s is the sign bit which is 1. and e =6.

so,

decimal number = (-1)^1 x (1+0.22035217284 ) x 2⁶

                            = -1 x 1.22035217284 x 64

                            = -78.1025390625

                           

Suppose you are organizing a party for a large group of your friends. Your friends are pretty opinionated, though, and you don't want to invite two friends if they don't like each other. So you have asked each of your friends to give you an \enemies" list, which identi es all the other people among your friends that they dislike and for whom they know the feeling is mutual.

Your goal is to invite the largest set of friends possible such that no pair of invited friends dislike each other. To solve this problem quickly, one of your relatives (who is not one of your friends) has offered a simple greedy strategy, where you would repeatedly invite the person with the fewest number of enemies from among your friends who is not an enemy of someone you have already invited, until there is no one left who can be invited. Show that your relative’s greedy algorithm may not always result in the maximum number of friends being invited to your party.

Answers

Answer:

Relative greedy algorithm is not optimal

Explanation:

Proving that Relative’s greedy algorithm is not optimal.

This can be further proved by the following example.

Let us assumethe friends to be invited be Ali, Bill, David, Dennis, Grace, Eemi, and Sam.

The enemy list of each friend is shown below:

• Ali: Bill. David, Dennis

• Bill: Ali, Grace, Eemi, Sam

• David: Ali, Grace, Eemi, Sam

• Dennis: Ali, Grace, Eemi, Sam

• Grace: Bill. David, Dennis. Eemi . Sam

• Eemi: Bill, David, Dennis, Grace, Sam

• Sam: Bill, David, Dennis, Eemi, Grace

From the enemy list, the one with fewer enemies is Ali.

If we invite Ali, then Bill, David, and Dennis cannot be invited.

Next person that can be invited is one from Grace, Eemi, and Sam

If we choose any one of them we cannot add any other person.

For example, if we choose Grace, all other members are enemies of Ali and Grace. So only Ali

and Grace can only be invited.

So we get a list of two members using relative’s greedy algorithm.

This is not the optimal solution.

The optimal solution is a list of 3 members

• Bill, David, and Dennis can be invited to the party.

Hence, it is proved that relative’s greedy algorithm is not optimal, where the maximum number of friends is not invited to the party.

The Greedy algorithm is not optimal for this case because it cannot invite all the friends.

What is Greedy Algorithm?

This refers to a modest approach that is taken to solve a problem by selecting the best option available to solve optimization problems.

Hence, we can see that if we use the greedy algorithm, we would have to make optimal selections to get the complete optimal system, and in this case, it is not optimal.

This is because, the optimal solution is a list of 3 members, and not all the friends can be invited.

Read more about greedy algorithm here:
https://brainly.com/question/13197481

This program builds on the program developed in part
1. This program will read a word search from the provided file name. you will develop six methods, (1) a method to search for a word placed in a horizontal direction(rows) in the word search,
(2) a method to search for a word placed in a vertical direction (columns) in the word search,
(3) a method to search for a word placed in a diagonal direction in the word search, and
(4) test methods for the horizontal, vertical, and diagonal search methods.

Answers

Answer:

The solution is in C++

Explanation:

// C++ programs to search a word in a 2D grid  

#include<bits/stdc++.h>  

using namespace std;  

// Rows and columns in given grid  

#define R 3  

#define C 14  

// For searching in all 8 direction  

int x[] = { -1, -1, -1, 0, 0, 1, 1, 1 };  

int y[] = { -1, 0, 1, -1, 1, -1, 0, 1 };  

// This function searches in all 8-direction from point  

// (row, col) in grid[][]  

bool search2D(char grid[R][C], int row, int col, string word)  

{  

// If first character of word doesn't match with  

// given starting point in grid.  

if (grid[row][col] != word[0])  

return false;  

int len = word.length();  

// Search word in all 8 directions starting from (row,col)  

for (int dir = 0; dir < 8; dir++)  

{  

 // Initialize starting point for current direction  

 int k, rd = row + x[dir], cd = col + y[dir];  

 // First character is already checked, match remaining  

 // characters  

 for (k = 1; k < len; k++)  

 {  

  // If out of bound break  

  if (rd >= R || rd < 0 || cd >= C || cd < 0)  

   break;  

  // If not matched, break  

  if (grid[rd][cd] != word[k])  

   break;  

  // Moving in particular direction  

  rd += x[dir], cd += y[dir];  

 }  

 // If all character matched, then value of must  

 // be equal to length of word  

 if (k == len)  

  return true;  

}  

return false;  

}  

// Searches given word in a given matrix in all 8 directions  

void patternSearch(char grid[R][C], string word)  

{  

// Consider every point as starting point and search  

// given word  

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

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

 if (search2D(grid, row, col, word))  

  cout << "pattern found at " << row << ", "

   << col << endl;  

}  

// Driver program  

int main()  

{  

char grid[R][C] = {"GEEKSFORGEEKS",  

    "GEEKSQUIZGEEK",  

    "IDEQAPRACTICE"

    };  

patternSearch(grid, "GEEKS");  

cout << endl;  

patternSearch(grid, "EEE");  

return 0;  

}  

This response outlines the creation of a word search program including six key methods: horizontal, vertical, and diagonal search methods, along with their respective test methods to ensure accuracy.

In this task, we aim to develop a program that reads a word search from a file and includes six main methods. Below are the steps and methods you need to implement:

1. Horizontal Search Method

Create a method to search for a word placed horizontally in the word search. You can iterate through each row and check for the presence of the target word within that row.

2. Vertical Search Method

Create a method to search for a word placed vertically in the word search. In this method, you'll iterate over each column, constructing potential matches vertically.

3. Diagonal Search Method

Create a method to search for a word placed diagonally in the word search. Handle both diagonals from top-left to bottom-right and top-right to bottom-left.

4. Test Methods

Develop test methods for horizontal, vertical, and diagonal search methods. Ensure you have test cases that cover various scenarios to validate the correctness of your searches.

The code for the following programs are:

class WordSearchSolver:

   def __init__(self, filename):

       self.grid = self.read_word_search(filename)

   def read_word_search(self, filename):

       # Method to read word search from file and return grid

       pass

   def horizontal_search(self, word):

       # Method to search for a word horizontally in the grid

       pass

   def vertical_search(self, word):

       # Method to search for a word vertically in the grid

       pass

   def diagonal_search(self, word):

       # Method to search for a word diagonally in the grid

       pass

   def test_methods(self):

       # Test methods for horizontal, vertical, and diagonal search

       pass

# Test the class

if __name__ == "__main__":

   filename = "word_search.txt"  # Example filename

   solver = WordSearchSolver(filename)

   solver.test_methods()

By implementing these methods, the program can effectively search for words in different orientations within the word search grid.

The greatest common divisor (GCD) of two values can be computed usingEuclid's algorithm. Starting with the values m and n, we repeatedly applythe formula: n, m = m, ni'.m until m is 0. At that point, n is the GCD ofthe original m and n. Write a program that finds the GCD of two numbersusing this algorithm.

Answers

Answer:

The answer is in the explanation and check the attached file for the output

Explanation:

GCD.py:

def gcd(a, b):

  if b > a:

       a, b = b, a

  while b != 0:

       t = b

       b = a % t

       a = t

   return a

def main():

   m = eval(input("Enter m: "))

   n = eval(input("Enter n: "))

   print("GCD(",m,",",n,") = ",gcd(m,n))

main()

Output: check the output in the attached file

Answer:

I am writing a C++ program.

#include <iostream> // for input output functions

using namespace std; // to identify objects like cin cout

int gcd(int m, int n) {

//function to compute greatest common divisor of two value m and n

  if (n == 0) //if value of n is equal to 0 (base condition)

  return m; // returns the value of m

  return gcd(n, m % n); }

// calls gcd function recursively until base condition is reached  

void get_value(int c, int d){ // function to obtain two values

  cout<<"Enter the two values: "<<endl;

//prompts user to enter values of c and d

  cin>>c>>d; //reads the input values of c and d

  while(c <= 0 || d<= 0){ // the loop continues to ask user to enter positive //values until user enters values greater than 0

      cout<<"Enter a positive value";

      cin>>c>>d;   } //reads values from user

    cout<<"GCD of "<< c <<" and "<< d <<" is "<< gcd(c, d); }

//calls gcd funtion to compute greatest common divisor of two values    

int main() { // main() function body

   int a,b; //two integer variables are declared

   get_value(a,b); // calls this method to take values of a and b from user

   char ch; // used to enter a choice by user to perform gcd again

   while(true)      {

//asks the user if he wants to continue to compute gcd

       cout<<"Would you like to do another computation or not?(Y/N)\n"<<endl;

       cin >> ch; //reads the choice user enters

/*if user enters Y or y then it calls get_value function to take values from user and computer gcd, if user types N or n then the program exits */

       if(ch == 'Y'|| ch =='y'){

           get_value(a,b);

       }else if(ch =='N'||ch =='n'){

           break;         }    }}

   

Explanation:

The program has three methods. gcd method that computes greatest common divisor (GCD) of two values can be computed using Euclid's algorithm. get_value method takes two positive integers from user to find gcd of these values. It keeps asking user to enter positive values until user enters positive values. Third is the main() function which calls get_value function and after computing gcd of two values, asks user to if he wants to find gcd again? If user types Y or y which indicates yes, it moves the program control to get_value function and if user enters n, then the program ends.

Write a program that asks the user for a CSV of the NYC Open Data Film Permits: There is a sample file for June 2019 film permits on github. Your program should then print out: the total number of permits in the file, the count of permits for each borough, and the five most popular locations (stored in the column: "Parking Held").

Answers

Answer:

Before running this program, make sure you have installed pandas module for python.

pip install pandas

import pandas as pd

import numpy as np

csv_file = input("Enter CSV File Name : ")

df = pd.read_csv(csv_file)

count_row = df.shape[0]

print("There were %d Film Permits in Total." %(count_row))

borough_count = df['Borough'].value_counts()

print(borough_count)

location_count = df['ParkingHeld'].value_counts().head(5)

print(location_count)

Explanation:

Answer:

pip install pandas

import pandas as pd

import numpy as np

csv_file = input("Enter CSV File Name : ")

df = pd.read_csv(csv_file)

count_row = df.shape[0]

print("There were %d Film Permits in Total." %(count_row))

borough_count = df['Borough'].value_counts()

print(borough_count)

location_count = df['ParkingHeld'].value_counts().head(5)

print(location_count)

Explanation:

Before running this program, make sure you already previously installed pandas module for python.

Import panda and numpy

Put csv file

count row

then tell to print

(a) Show how to use (the Boolean formula satisfiability program) satisfiable num (and substitute) to find a satisfying assignment that minimizes the number of variables set to TRUE. Write the pseudo-code. HINT: eurtottesebtsumselbairavynamwohenimretedtsrif. HINT for hint: sdrawkcabtidaer. (b) How fast is your algorithm? Justify.

Answers

Final answer:

To find the satisfying assignment that minimizes the number of variables set to TRUE using the satisfiable num program, follow the provided pseudo-code.

Explanation:

To use the Boolean formula satisfiability program satisfiable num to find a satisfying assignment that minimizes the number of variables set to TRUE, you can follow the pseudo-code:

Convert the Boolean formula to Conjunctive Normal Form (CNF). Assign FALSE to the first variable and check if the formula is still satisfiable. If the formula is still satisfiable, assign TRUE to the first variable. If not, proceed to the next variable. Repeat step 3 for all variables, checking if assigning FALSE minimizes the number of variables set to TRUE. Output the assignment that minimizes the number of variables set to TRUE.

he cost of an international call from New York to New Delhi is calculated as follows: connection fee,$1.99; $2.00 for the first three minutes; and $0.45 for each additional minute. Write a program thatprompts the user to input a number. The program should then output the number of minutes the calllasted and output the amount due. Format your output with two decimal places

Answers

Answer:

// This program is written in C++ programming language

// Comments are used for explanatory purpose

// Program starts here

#include<iostream>

using namespace std;

int main ()

{

// Declare and initialize variables

float connecfee = 1.99;

float first3 = 2.00;

float addmin = 0.45; float cost;

int minutes;

// Prompt user for minutes talked

cout<<"Enter Number of Minutes: ";

cin>>minutes;

// Calculate cost;

if(minutes < 1)

{

cout<<"Enter a number greater than 0";

}

else if(minutes <= 3)

{

// Calculating cost for minutes less than or equal to 3

cost = connecfee + first3 * minutes;

cout<<"Talk time of "<<minutes<<" minutes costs "<<cost;

}

else

{

cost = connecfee + first3 * 3 + addmin * (minutes - 3);

cout<<"Talk time of "<<minutes<<" minutes costs "<<cost;

}

return 0;

}

// End of Program

The last step on Kotter’s Eight-Step Change Model is to anchor the changes in corporate culture; to make anything stick, it must become habit and part of the culture. Therefore, it is important to find opportunities to integrate security controls into day-to-day routines.
Do you believe this to be true or false? Why? 12.In general, implementing security policies occurs in isolation from the business perspectives and organizational values that define the organization’s culture. Is this correct or incorrect? Why?

Answers

Answer:

Therefore, it is important to find opportunities to integrate security controls into day-to-day routines.

Do you believe this to be true- Yes.

In general, implementing security policies occurs in isolation from the business perspectives and organizational values that define the organization’s culture. Is this correct or incorrect? - Incorrect

Explanation:

Truly, it is important to find opportunities to integrate security controls into day-to-day routines, this is in order to minimize future security threats by formulating company-wide security policies and educating employees on daily risk prevention in their work routines. In the operational risk controls, vigilant monitoring of employees must be implemented in order to confirm that policies are followed and to deter insider threats from developing.

Flexing and developing policies as resources and priorities change is the key to operational risk controls.

These risk controls implementation in organizational security is not a one-time practice. Rather, it is a regular discipline that the best organizations continue to set and refine.

For better preparation of an organization towards mitigating security threats and adaptation to evolving organizational security needs, there must be a proactive integration of physical information and personnel security while keeping these risk controls in mind.

12. In general, implementing security policies occurs in isolation from the business perspectives and organizational values that define the organization’s culture - Incorrect.

When security policies are designed, the business perspectives and the organizational values that define the organization’s culture must be kept in mind.

An information security and risk management (ISRM) strategy provides an organization with a road map for information and information infrastructure protection with goals and objectives that ensure capabilities provided are adjusted to business goals and the organization’s risk profile. Traditionally, ISRM has been considered as an IT function and included in an organization’s IT strategic planning. As ISRM has emerged into a more critical element of business support activities, it now needs its own independent strategy to ensure its ability to appropriately support business goals and to mature and evolve effectively.

Hence, it is observed that both the Business Perspective and Organisational goals are taken into consideration while designing Security policies.

2. After your explanation in part 1), Barney agrees to use SHA-2 for hashing. However, to save space he proposes to only use the first 128 bits to create a 128 bit hash. He argues that since 128 bit encryption keys are secure, a 128 bit hash should also be secure. Explain what kind of attack a 128 bit hash would be vulnerable to, and why.

Answers

Answer:

Preimage attack and collision attacks.

Explanation:

When SHA-2 hashing is used with only 128 bit hash, It usually makes the system vulnerable to attack.

Main disadvantage in case of truncated SHA is that there exist no reduction proofs to the original hash function. It implies that the truncated version is thus is very much resistant to preimage attack and collision attacks.

Collision resistant system does not always implies to collision free. If 128 bit hash is used for say any file greater than 16 bytes, then atleast two collision occurs. It can occur anytime in the beginning in starting one or two documents at any later stage. It will lead to a situation where one will not be able to write second or will ultimately overwrite the first one.

Final answer:

Reducing a SHA-2 hash to 128 bits makes it susceptible to a birthday attack due to the collision probability. The effectiveness of hash security relies on collision resistance, not just the length of the hash.

Explanation:

The Vulnerability of a 128-bit Hash

Using only the first 128 bits of a SHA-2 hash can make it vulnerable to a birthday attack. This type of attack exploits the mathematical Birthday Paradox, where the probability of two people sharing the same birthday rises disproportionately with the number of individuals in the group. In cryptographic terms, it means that with a hash of 128 bits in length, an attacker only needs roughly 264 attempts to find two different inputs that produce the same hash value, which is referred to as a collision. This is feasible with modern computing power. Therefore, reducing the length of the hash from its original size compromises its collision resistance.

Comparing hashing and encryption directly is not entirely appropriate. While a 128-bit encryption key may be considered secure because it requires 2128 attempts to crack, this doesn't translate the same way for hashing. Hashes are not encrypted; they are fixed-size outputs for inputs of arbitrary size, and their security is largely reliant on their collision resistance and unpredictability.

Write a program that will ask the user for a person’s name and social security number. The program will then check to see if the social security number is valid. An exception will be thrown if an invalid SSN is entered. You will be creating your own exception class in this program. You will also create a driver program that will use the exception class. Within the driver program, you will include a static method that throws the exception.

Answers

Answer:

See explaination for the program code

Explanation:

//SocSecProcessor.java:

import java.util.Scanner;

public class SocSecProcessor

{

public static void main (String [] args)

{

Scanner keyboard = new Scanner (System.in);

String name;

String socSecNumber;

String response;

char answer = 'Y';

while (Character.toUpperCase(answer) == 'Y')

{

try

{

// Task #2 step 1 - To do:

// promote user to enter name and ssn number.

// save the input to variable name and SocSecNumber. Such as:

// System.out.print("Name? ");

// name = keyboard.nextLine();

// validate SSN number by calling isValid(socSecNumber).

// output the checking result.

System.out.print("Name?");

name = keyboard.nextLine();

System.out.print("SSN?");

socSecNumber = keyboard.nextLine();

if(isValid(socSecNumber)){

System.out.println(name + " " + socSecNumber + "is Valid");

}

}

catch (SocSecException e) // To do: catch the SocSecException

{

System.out.println(e.getMessage());

}

System.out.print("Continue? ");

response = keyboard.nextLine();

answer = response.charAt(0);

}

}

private static boolean isValid(String number)throws SocSecException

{

boolean goodSoFar = true;

int index = 0;

// To do: Task #2 step 2

// 1. check the SSN length. Throw SocSecException if it is not 11

if (number.length() != 11)

{

throw new SocSecException("wrong number of characters ");

}

for( index=0;index<number.length();++index){

if(index==3 || index==6){

if (number.charAt(index) != '-'){

throw new SocSecException("dashes at wrong positions");

}

}else if (!Character.isDigit(number.charAt(index))){

throw new SocSecException("contains a character that is not a digit");

}

}

// 2. check the two "-" are in right position. Throw SocSecException if it is not

// if (number.charAt(3) != '-')

// 3. check other position that should be digits. Throw SocSecException if it is not

// if (!Character.isDigit(number.charAt(index)))

return goodSoFar;

}

}

See attachment

g write a program which will take a list of integer number from the user as input and find the maximum and minimum number from the list. first, ask the user for the size of the array and then populate the array. create two user define functions for finding the minimum and maximum numbers from the array. finally, you need to print the entire list along with the max and min numbers. you have to use arrays and user-define functions for the problem.

Answers

Answer:

see explaination

Explanation:

#include <stdio.h>

// user defined functions

int min(int arr[], int n)

{

int m=arr[0];

for(int i=1;i<n;i++)

if(arr[i]<m)

m=arr[i];

// return minimum

return m;

}

int max(int arr[], int n)

{

int m=arr[0];

for(int i=1;i<n;i++)

if(arr[i]>m)

m=arr[i];

// return maximum

return m;

}

int main() {

int n;

// read N

printf("Enter number of elements: ");

scanf("%d",&n);

// read n values into list

int arr[n];

printf("Enter elements: ");

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

scanf("%d",&arr[i]);

// find max and min

printf("The List is: ");

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

printf("%d ",arr[i]);

printf("\nThe minimum value is: %d\n",min(arr,n));

printf("The maximum value is: %d\n",max(arr,n));

return 0;

}

see attachment for screenshot and output

Assume a 16-word direct mapped cache with b=1 word is given. Also assume that a program running on a computer with this cache memory executes a repeating sequence of lw instructions involving the following memory addresses in the exact sequence is given: Ox74 OxAO Ox78 0x38C OXAC 0x84 0x88 0x8C 0x7c 0x34 Ox38 0x13C 0x388 0x18C

A.)Show the placement of the given instruction addresses in this cache.
B.) Calculate the miss rate of this cache for the given list of instruction addresses. Please show your work.

Answers

Answer:

a) See the placement of the given instruction addresses in this cache in the picture.

b) The miss rate for the below instructions address sequence is 100% as no address is repeated.

Explanation:

What is the purpose of the Excel Function Reference?
to look up functions and their purposes
to add customized functions to the list
to delete functions from the list
to sort and organize functions in the list

Answers

Answer:

To look up functions and their purposes

Explanation:

Edg

Answer:

a on edge

Explanation:

just took the question

Write a program that will ask the user to input a phrase (multiple word sentence), and an integer value. A static function will be created that takes the sentence (string) and integer as input parameters and returns a single word (string) of that sentence. If the integer was the number three, then the word returned would be the third word in the sentence. If the integer given in zero or negative, simply return an empty string. (do not let it crash) If the integer given is higher than the number of words in the sentence, then just return the last word.

Answers

Answer:

See explaination

Explanation:

import java.util.Scanner;

public class Word

{

public static void main(String args[])

{

Scanner read=new Scanner(System.in);

char repeat='Y';

String phrase=null;

int index=0;

while(repeat=='Y')

{

System.out.println("enter a phrase :");

phrase=read.nextLine();

while(index<=0)

{

System.out.println("enter an index greater than 0");

index=Integer.parseInt(read.nextLine());

}

String s;

int spaces = phrase == null ? 0 : phrase.length() - phrase.replace(" ", "").length();

int numofwords=spaces+1;

if(index>numofwords)

{

index=numofwords;

}

System.out.println("word is: "+ getWord(phrase,index));

System.out.println("do you want to repeat (Y/N)");

repeat=read.nextLine().charAt(0);

index=0;

}

read.close();

}

private static String getWord(String phrase, int index) {

// TODO Auto-generated method stub

Scanner in =new Scanner(phrase);

String word=null;

int wordindex=0;

while(wordindex!=index)

{

word=in.next();

wordindex++;

}

in.close();

return word;

}

}

Check attachment screenshot

A babysitter charges $2.50 an hour until 9:00 PM when the rate drops to$1.75 an hour (the children are in bed). Write a program that accepts astarting time and ending time in hours and minutes and calculates the totalbabysitting bill. You may assume that the starting and ending times are ina single 24-hour period. Partial hours should be appropriately prorated.

Answers

Answer:

print("enter starting time hours")

st_hours=int(input()) #starting time hours

print("minutes")

st_minutes=int(input()) #starting time minutes

print("enter ending time hours")

et_hours=int(input()) #ending time hours

print("minutes")

et_minutes=int(input()) #ending time minutes

cost=2.50

if (st_hours<21 and et_hours>21): #if starting time is less than 21 and ending time is greater than 21

a_hours=et_hours-21

a_minutes=et_minutes #taking time after 21 from ending time ending time-21

time_minutes=60-st_minutes #converting all the time into minutes

time_hours=21-(st_hours+1)

time_hours=time_hours*60

time=time_hours+time_minutes

cost=(cost/60)*time

time=(a_hours*60)+a_minutes

cost=cost+(1.75/60)*time

print("cost=$",cost)

elif(st_hours>=21): #if starting time is greater than 21

time_hours=et_hours-(st_hours+1)

time_minutes=(60-st_minutes)+et_minutes #converting time into minutes

time=(time_hours*60)+time_minutes

cost=(1.75/60)*(time)

print("cost=$",cost)

elif(et_hours<=21): #if ending time is less than 21

time_hours=et_hours-(st_hours+1)

time_minutes=(60-st_minutes)+et_minutes

time=(time_hours*60)+time_minutes

cost=(2.50/60)*time

print("cost=$",cost)

Explanation:

This is a conditional program, the conditions applied are if and else if.

The resultant output was gotten using this three steps:

(1) If starting time is less than 21 and ending time is greater than 21

Then I converted the time into minutes before 21

ex:- 8:30

21-9= 12*60= 720 + 30 = 750

Then I calculated the bill.

750 * (2.50 / 60)

Then I converted the time after 21 and then calculated the bill and printed it.

(2)If starting time is greater than 21

Converted time into minutes and multiplied it with (1.75 / 60) to get the bill.

(3) If ending time is less than 21

Converted time into minutes and multiplied it with (2.50 / 60) to get the bill.

Please check attachment for program code screenshot.

Final answer:

In summary, the student's homework entails creating a program to calculate the total babysitting bill based on varying hourly rates before and after 9:00 PM, within a 24-hour period.

Explanation:

The question pertains to creating a program that calculates the total babysitting bill based on hourly rates that change after 9:00 PM. The program must accept a starting time and an ending time in hours and minutes and, with the given rates of $2.50 before 9:00 PM and $1.75 after 9:00 PM, compute the total cost considering partial hours.

An example of how the calculations may work is given: If you hired 5 people at a cost of $15 per hour each and they worked for 2 hours, the total cost would be 5 people \\* $15/hour \\* 2 hours = $150.

To apply this logic to the babysitting scenario, the program would need to calculate the number of hours worked at each rate, then multiply the number of hours by the corresponding rate and sum these amounts to arrive at the final bill.

Write a modular program that allows the user to enter a word or phrase and determines whether the word or phrase is a palindrome. A palindrome is a word or phrase that reads the same backwards as forwards. Examples include: civic, kayak, mom, noon, racecar, Never odd or even., and Was it a Rat I saw

Answers

Answer:

import java.util.Scanner;

public class num10 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

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

       String word = in.nextLine();

       String reversed = "";

       //Get the length of the string entered

       int length = word.length();

       //Loop through the string and reverse th string

       for ( int i = length - 1; i >= 0; i-- )

           reversed = reversed + word.charAt(i);

       //Compare the two strings "word" and "reversed"

       if (word.equals(reversed))

           System.out.println(word+" is a palindrome");

       else

           System.out.println(word+" is not a palindrome");

   }

}

Explanation:

Since we know that a palindrome word is a word that reads the same forward and backward, The Idea here is:

To obtain a word from a user.  Use a for loop to reverse the word and store in another variableUse if....else to compare the two strings and determine if they are equal, if they are equal then the word is palindrome.

The function below takes one parameter: a list of strings (string_list). Complete the function to return a single string from string_list. In particular, return the string that contains the most copies of the word the as upper case or lower case. Be sure, however, to return the string with its original capitalization. You may want to use the count() method of sequences to implement this function.

Answers

Answer:

def string_with_most_the(string_list):

   index = 0

   count = []

   max_length = 0

   for i in range(len(string_list)):

       s1 = string_list[i].lower()

       count.append(s1.count("the"))

       if count[i] > max_length:

           max_length = count[i]

           index = i

   return string_list[index]

Explanation:

Create a function called string_with_most_the that takes one parameter, string_list

Inside the function:

Initialize the variables

Initialize a for loop that iterates through string_list

Set the lower case version of the strings in string list to s1

Count how many "the" each string in string_list contain and put the counts in the count list

If any string has more "the" than the previous one, set its count as new maximum, and update its index

When the loop is done, return the string that has maximum number of "the", string_list[index]

Two files named numbers1.txt and numbers2.txt both have an unknown number of lines, each line consisting of a single positive integer. Write some code that reads a line from one file and then a line from the other file. The two integers are multiplied together and their product is added to a variable called scalar_product which should be initialized to zero. Your code should stop when it detects end of file in either file that it is reading. For example, if the sequence of integers in one file was "9 7 5 18 13 2 22 16" and "4 7 8 2" in the other file, your code would compute: 4*9 + 7*7 + 8*5 + 2*18 and thus store 161 into scalar_product.

Answers

Final answer:

The code reads lines from two files and multiplies the integers from each line together, adding the products to a variable called scalar_product.

Explanation:

The task requires reading lines from two files and multiplying the corresponding integers from each line together. The products are then added to a variable called scalar_product. The code should stop when it reaches the end of either file. This can be achieved by using a loop to read lines from both files simultaneously and perform the multiplication and addition operations:

scalar_product = 0
with open('numbers1.txt') as file1, open('numbers2.txt') as file2:
   for line1, line2 in zip(file1, file2):
       num1 = int(line1.strip())
       num2 = int(line2.strip())
       scalar_product += (num1 * num2)
print(scalar_product)

This example demonstrates a simple but effective way to calculate the scalar product of two sets of integers from text files in Python.

Final answer:

The question asks for code that calculates the scalar product of integers read from two files. The process involves multiplying integers from corresponding lines and summing the products. The code in Python was provided with error handling for missing files or non-integer values.

Explanation:

The task given involves writing code that reads from two files containing lines of positive integers, multiplies corresponding numbers from each line of these files together, and adds the product to a variable named scalar_product, which has been initialized to zero. This process is reminiscent of computing the scalar product  or dot product in mathematics, though in this case, the operation is performed with integers from files instead of vector components. It is important that the code stops processing once it reaches the end of either file.

Below is an example of how the code could be implemented in Python:

scalar_product = 0
try:
   with open('numbers1.txt', 'r') as file1, open('numbers2.txt', 'r') as file2:
       for num1, num2 in zip(file1, file2):
           scalar_product += int(num1) * int(num2)
except FileNotFoundError:
   print("One of the files was not found.")
except ValueError:
   print("Found non-integer line.")
This code initializes the scalar_product, opens both files concurrently, and uses a zip function to read corresponding lines. It then multiplies these integers and adds the result to scalar_product. Additionally, the code includes error handling to deal with potential issues like missing files and invalid content.

• Consider the following algorithm to calculate the sum of the n elements in an integer array a[0..n-1]. sum = 0; for (i = 0; i < n; i++) sum += a[i]; print sum; 1. What is the growth rate function for the above algorithm. (How many steps are executed when this algorithm runs?) 2. What is big O notation?

Answers

Answer:

Check the explanation

Explanation:

The loop runs for when i=0 to i=n-1 ie <n which consequently means that there are n iterations of the for loop, that is equal to array size n, therefore growth function will be

F(n) = n

Also big o notation is the upper bound of the growth function of any algorithm which consequently means that the big oh notation of this code's complexity O(n)

python Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in a program that takes two integer inputs, and outputs the largest magnitude value.

Answers

Final answer:

To solve this problem, write a function called max_magnitude() that takes two integer input parameters. Inside the function, compare the magnitudes of the two integers using the absolute value function, abs(). Return the larger magnitude value using the max() function.

Explanation:

To solve this problem, you can write a function called max_magnitude() that takes two integer input parameters. Inside the function, compare the magnitudes of the two integers using the absolute value function, abs(). Return the larger magnitude value using the max() function.

Here's an example implementation:

def max_magnitude(num1, num2):
   return max(abs(num1), abs(num2))

# Example usage
test1 = int(input('Enter first number: '))
test2 = int(input('Enter second number: '))

result = max_magnitude(test1, test2)
print(f'Largest magnitude value: {result}')

In this example, we prompt the user to enter two integers and store them in test1 and test2. We then call the max_magnitude() function with the inputs as arguments, and store the result in result. Finally, we print the largest magnitude value.

Input a total dinner amount (ex. $55.40) and the number of guest. The function should calculate the total cost (including 15% tip) and as equally as possible distribute the cost of the entire meal between the number of provided guests. (e.g., splitTip (15.16, 3) ==> guest1-$5.06, guest2-$5.05, guest3-$5.05). Whatever logic is used for uneven amounts should be deterministic and testable (all values rounded to cents - 2 decimal places).

Answers

Answer:

def splitTip(totalCost, numGuest):    finalCost = totalCost * 0.15 + totalCost      avgCost = finalCost / numGuest      for i in range(numGuest):        print("Guest " + str(i+1) + ": $" + str(round(avgCost,2))) splitTip(15.16,3)

Explanation:

The solution is written in Python 3.

To calculate the average cost shared by the guests, we create a function that takes two input, totalCost and numGuest (Line 1). Next apply the calculation formula to calculate the final cost after adding the 15% tips (Line 2). Next calculate the average cost shared by each guest by dividing the final cost by number of guest (Line 3). At last, use a for loop to print out the cost borne by each guest (Line 4-5).  

Suppose we perform a sequence of stack operations on a stack whose size never exceeds kk. After every kk operations, we make a copy of the entire stack for backup purposes. Show that the cost of nn stack operations, including copying the stack, is O(n)O(n) by assigning suitable amortized costs to the various stack operations.

Answers

Answer:

The actual cost of  (n) stack operations will be two ( charge for push and pop )

Explanation:

The cost of (n) stack operations involves two charges which are actual cost of operation of the stack which includes charge for pop ( poping an item into the stack) which is one and the charge for push ( pushing an item into the stack ) which is also one. and the charge for copy which is zero. therefore the maximum size of the stack operation can never exceed K because for every k operation there are k units left.

The amortized cost of the stack operation is constant 0 ( 1 ) and the cost of performing an operation on a stack made up of n elements will be assigned as 0 ( n )

The amortized cost of n stack operations, including backup copying after every k operations, remains O(n). This is achieved by assigning an amortized cost of 2 to each operation and distributing the copying cost evenly.

To analyze the cost of stack operations including backups, we consider the sequence of operations and calculate the total cost over time, assigning an amortized cost. Here’s the breakdown:

Each stack operation (push or pop) is assigned an amortized cost of 2.Every k operations, the entire stack is copied. This copy operation takes O(k) time.

Since each operation has an amortized cost of 2, and every k operations involve an additional O(k) time for copying, the total cost for n operations is O(n) over time. This is because the cumulative effect of the every-k copying is distributed evenly across the individual operations, ensuring that the average cost per operation remains constant.

Therefore, the total cost comprises the individual stack operations plus the copying operations, yielding an overall cost of O(n).

A large IPv4 datagram is fragmented into 4 fragments at router 1 to pass over a network with an MTU of 1500 bytes. Assume each fragment is larger than 900 bytes. Then, each fragment arrives at router 2, which wants to forward the fragments over a network with an MTU of 900 bytes to deliver to the destination.

How many fragments will arrive at the destination host?

Answers

Answer:

8

Explanation:

Having in mind that all the given 4 fragments are larger than 900 bytes and smaller than 1500 bytes, this will make router 2 to fragment each fragment by router 1 into 2 fragments .

Hence, 4*2 = 8 fragments will reach at destination host.

JAVA
Write a method that takes in two numbers that represent hours worked and hourly pay. The function should return the total amount paid for the hours entered. For any hours over 40, you should receive overtime pay, which is 1.5 times the regular pay.

Example:

payday(50, 10.00) --> 550.0
payday(20, 5.00) --> 100.0

public static double payDay(int hours, double pay)
{
}

Answers

Answer:

Answer is in the provided screenshot!

Explanation:

Steps required:

check if pay is greater than 40, if so then handle logic for pay over 40, else treat normally.

We will use linear interpolation in a C program to estimate the population of NJ between the years of the census, which takes place every 10 years. For our program the x's are the years and the y's are the population. So given a year, we will use linear interpolation to calculate the population for that year, using the surrounding census years.

1. read the data from the file njpopulation.dat into two arrays, one for the years and one for the populations
2. use int for the years and float for the populations
3. create a loop to do the following, until the user enters 0 1. prompt the user to enter a year between 1790 and 2010 2. give an error message and reprompt if the user enters a value outside the valid range 3. use linear interpolation to approximate the population for the given year
4. print the year and the approximate population; print the population with two decimal places

Answers

Answer:

See explaination for program code

Explanation:

program code below:

#include<stdio.h>

int main()

{

//file pointer to read from the file

FILE *fptr;

//array to store the years

int years[50];

//array to store the population

float population[50];

int n = 0, j;

//variables for the linear interpolation formula

float x0,y0,x1,y1,xp,yp;

//opening the file

fptr = fopen("njpopulation.dat", "r");

if (fptr != NULL)

{

//reading data for the file

while(fscanf(fptr, "%d %f", &years[n], &population[n]) == 2)

n++;

//prompting the user

int year = -1;

printf("Enter the years for which the population is to be estimated. Enter 0 to stop.\n\n");

while(year != 0)

{

printf("Enter the year (1790 - 2010) : ");

scanf("%d", &year);

if (year >= 1790 && year <= 2010)

{

//calculating the estimation

xp = year;

for (j = 0; j < n; j++)

{

if (year == years[j])

{

//if the year is already in the table no nedd for calculation

yp = population[j];

}

else if (j != n - 1)

{

//finding the surrounding census years

if (year > years[j] && year < years[j + 1])

{

//point one

x0 = years[j];

y0 = population[j];

//point two

x1 = years[j + 1];

y1 = population[j + 1];

//interpolation formula

yp = y0 + ((y1-y0)/(x1-x0)) * (xp - x0);

}

}

}

printf("\nEstimated population for year %d : %.2f\n\n", year, yp);

}

else if (year != 0)

{

printf("\nInvalid chioce!!\n\n");

}

}

printf("\nAborting!!");

}

else

{

printf("File cannot be opened!!");

}

close(fptr);

return 0;

}

OUTPUT :

Enter the years for which the population is to be estimated. Enter 0 to stop.

Enter the year (1790 - 2010) : 1790

Estimated population for year 1790 : 184139.00

Enter the year (1790 - 2010) : 1855

Estimated population for year 1855 : 580795.00

Enter the year (1790 - 2010) : 2010

Estimated population for year 2010 : 8791894.00

Enter the year (1790 - 2010) : 4545

Invalid chioce!!

Enter the year (1790 - 2010) : 1992

Estimated population for year 1992 : 7867020.50

Enter the year (1790 - 2010) : 0

Aborting!!

Other Questions
Suppose you sell surfboards for a living, and you expect the price of surfboards to increase at the same rate as inflation; you adjust your prices accordingly. If this does not occur, then it must be true that: Please help I cant fail after all the hard work I have put in Ben is 20 years older than Daniel. Ben and Daniel first met two years ago. Three years ago, Ben was 3 times as old as Daniel. How old is Daniel now? Which are the center and radius of the circle with equation (x + 5)2 + (y 4)2 = 9? What is the surface area of the cylinder with height 5 in and radius 3 in? Roundanswer to the nearest thousandth In how many ways is it possible for 15 students to arrange themselves among 15 seats in the front row of an auditorium? How much is 1.7.01 (step-by-step) Ron wants to buy a video game with a selling price of $48. It is on sale for 50% off. The sales tax in his state is 4.5%.How much is the discount? Averigua las diferentes intensidades, la potencia total y el gasto en (de un mes de 30 das con el equipo conectado todo el tiempo) en el siguiente caso: Componente Tensin (V) Potencia (P) CPU 0,95 V 27,97 W RAM 1,257 V 2,96 W Tarjeta Grfica 3,28 V 75,3 W HDD 5,02 V 19,3 W Ventiladores 12,02 V 2,48 W Placa base 3,41 V 18,3 W Kenyl covers the front of a circular bulletin board with fabric that costs 1.48 per square foot. The bulletin board has a radius of 2.5 feet. Kenyl will count only the cost the exact amount of fabric he uses What is the cost of the fabric. Round to the nearest cent. Willys only source of wealth is his chocolate factory. He has the utility function p(cf)1/2 + (1 p)(cnf)1/2,where p is the probability of a flood, 1 p is the probability of no flood, and cf and cnf are his wealth contingent on a flood and on no flood, respectively. The probability of a flood is p = 1/6. The value of Willys factory is $500,000 if there is no flood and $0 if there is a flood. Willy can buy insurance where if he buys $x worth of insurance, he must pay the insurance company $2x/17 whether there is a flood or not but he gets back $x from the company if there is a flood. Willy should buy: a) no insurance since the cost per dollar of insurance exceeds the probability of a flood b) enough insurance so that if there is a flood, after he collects his insurance, his wealth will be 1/4 of what it would be if there were no flood c) enough insurance so that if there is a flood, after he collects his insurance, his wealth will be the same whether there was a flood or not d) enough insurance so that if there is a flood, after he collects his insurance, his wealth will be 1/3 of what it would be if there were no flood e) enough insurance so that if there is a flood, after he collects his insurance, his wealth will be 1/5 of what it would be if there were no flood In Drosophila, the homeotic genes act in combination to specify the identity of the 14 body segments. Two clusters of homeotic genes have been found on chromosome 3: the______complex consists of five genes, and the_______complex consists of three genes. When Robert failed his test, he was very upset and concerned about his midterm grade. However, he told himself that the failing grade was a result of his rude roommate and the noise in the dorm. Which of Freud's defense mechanisms is helping Robert feel less anxious about the grade Lane Company manufactures a single product that requires a great deal of hand labor. Overhead cost is applied on the basis of standard direct labor-hours. The budgeted variable manufacturing overhead is $2 per direct labor-hour and the budgeted fixed manufacturing overhead is $480,000 per year. The standard quantity of materials is 3 pounds per unit and the standard cost is $7 per pound. The standard direct labor-hours per unit is 1.5 hours and the standard labor rate is $12 per hour. The company planned to operate at a denominator activity level of 60,000 direct labor-hours and to produce 40,000 units of product during the most recent year. Actual activity and costs for the year were as follows: Actual number of units produced 42,000 Actual direct labor-hours worked 65,000 Actual variable manufacturing overhead cost incurred $ 123,500 Actual fixed manufacturing overhead cost incurred $ 483,000 Required: 1. Compute the predetermined overhead rate for the year. Break the rate down into variable and fixed elements. The population of a particular country was 22 million in 1985; in 1993, it was 31 million. The exponential growth function A=22e^kt describes the population of this country t years after 1985. Use the fact that 8 years after 1985 the population increased by 9 million to find k to three decimal places. What is the same about the beginnings of the Blackfeet and Apache myths?In both myths, there is no water,In both myths, there is no earth.In both myths, there is no lightIn both myths, there is no Sun Simplify 6xy - 20y + 7z - 8x + 25y - 11z What does it mean to say there is an association between characteristics in a two-way frequency table? 11. Cite text evidence to tell why fear is helpful to us. One cubic foot of water can store 312 Btu of thermal energy. On a cold winter day a well-constructed home may require 100,000 Btu of nighttime space heating. What is the volume of water required to store this energy?