After reading the case presented in the module, write a short response to the following discussion questions and ethical decision making scenario. Discussion Questions
What questions should Iris ask Charlie about the new job, Kelvin’s team, and the future of the company?
What questions should Iris ask Kelvin about the new job?
Had you been in Kelvin’s place, what would you have done differently to prepare for this meeting?

Answers

Answer 1

Final answer:

Iris should ask Charlie and Kelvin thorough questions about the job's responsibilities, the team dynamics, and the company's future. Reflecting on past decisions with an understanding of cognitive bias leads to better outcomes. It's essential to commit to ongoing critical reflection to avoid future biases in decision-making.

Explanation:

Discussion Questions for Iris

When considering questions that Iris should ask Charlie, she should be inquisitive about the specifics of the new job, the dynamics within Kelvin's team, and the future of the company. This includes asking about the job responsibilities, the team's current projects and goals, the team's working style and culture, any potential for advancement, and the company's vision for the future and stability.

Questions for Kelvin

Regarding questions for Kelvin, Iris could probe deeper into how the role fits into the company's larger strategy, how success will be measured for the new position, what the expectations are during the first few months, and how Kelvin envisions the position evolving. These questions would provide Iris with a comprehensive understanding of how her potential role manifests within the company's framework.

Hypothetical Scenario as Kelvin

If placed in Kelvin's position, to prepare for the meeting, I would ensure that I clearly understood the objectives for the new role, prepared a structured plan outlining how I would integrate the new member into the team, and had a thorough understanding of the company's future plans to address any inquiries. Reflecting on past decisions through the lens of cognitive bias would help mitigate any irrational elements involved in decision-making.

Impact of Different Behaviors

Had a different approach been taken, such as being more critical or self-aware, the consequences may have included more informed decision-making and reduced chances of miscommunication. Understanding the cognitive bias and employing critical reflection and metacognition could have led to better outcomes and a healthier decision-making process.

Conclusion and Lessons Learned

In conclusion, reflecting on experiences and understanding cognitive biases can profoundly impact personal growth and decision-making. This level of self-awareness can lead to improved choices in the future and help avoid repeating the same mistakes. Committing to ongoing critical reflection and seeking diverse perspectives are steps one can take today to prevent cognitive bias from clouding judgment.


Related Questions

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.

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

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]

[1] Please find all the candidate keys and the primary key (or composite primary key) Candidate Key: _______________________ Primary Key: ____________________________ [2] Please find all the functional dependencies ________________________________________________ _________________________________________________ __________________________________________________ _____________________________________________________ [3] Please find out the second normal form (in relational schema). [4] Please find out the third normal form.

Answers

Answer:

Check the explanation

Explanation:

1. The atomic attributes can't be a primary key because the values in the respective attributes should be unique.

So, the size of the primary key should be more than one.

In order to find the candidate key, let the functional dependencies be obtained.

The functional dependencies are :

Emp_ID -> Name, DeptID, Marketing, Salary

Name -> Emp_ID

DeptID -> Emp_ID

Marketing ->  Emp_ID

Course_ID -> Course Name

Course_Name ->  Course_ID

Date_Completed -> Course_Name

Closure of attribute { Emp_ID, Date_Completed } is { Emp_ID, Date_Completed , Name, DeptID, Marketing, Salary, Course_Name, Course_ID}

Closure of attribute { Name , Date_Completed } is { Name, Date_Completed , Emp_ID , DeptID, Marketing, Salary, Course_Name, Course_ID}

Closure of attribute { DeptID, Date_Completed } is { DeptID, Date_Completed , Emp_ID,, Name, , Marketing, Salary, Course_Name, Course_ID}

Closure of attribute { Marketing, Date_Completed } is { Marketing, Date_Completed , Emp_ID,, Name, DeptID , Salary, Course_Name, Course_ID}.

So, the candidate keys are :

{ Emp_ID, Date_Completed }

{ Name , Date_Completed }

{ DeptID, Date_Completed }

{ Marketing, Date_Completed }

Only one candidate key can be a primary key.

So, the primary key chosen be { Emp_ID, Date_Completed }..

2.

The functional dependencies are :

Emp_ID -> Name, DeptID, Marketing, Salary

Name -> Emp_ID

DeptID -> Emp_ID

Marketing ->  Emp_ID

Course_ID -> Course Name

Course_Name ->  Course_ID

Date_Completed -> Course_Name

3.

For a relation to be in 2NF, there should be no partial dependencies in the set of functional dependencies.

The first F.D. is

Emp_ID -> Name, DeptID, Marketing, Salary

Here, Emp_ID -> Salary ( decomposition rule ). So, a prime key determining a non-prime key is a partial dependency.

So, a separate table should be made for Emp_ID -> Salary.

The tables are R1(Emp_ID, Name, DeptID, Marketing, Course_ID, Course_Name, Date_Completed)

and R2( Emp_ID , Salary)

The following dependencies violate partial dependency as a prime attribute -> prime attribute :

Name -> Emp_ID

DeptID -> Emp_ID

Marketing ->  Emp_ID

The following dependencies violate partial dependency as a non-prime attribute -> non-prime attribute :

Course_ID -> Course Name

Course_Name ->  Course_ID

So, no separate tables should be made.

The functional dependency Date_Completed -> Course_Name has a partial dependency as a prime attribute determines a non-prime attribute.

So, a separate table is made.

The final relational schemas that follows 2NF are :

R1(Emp_ID, Name, DeptID, Marketing, Course_ID, Course_Name, Date_Completed)

R2( Emp_ID , Salary)

R3 (Date_Completed, Course_Name, Course_ID)

For a relation to be in 3NF, the functional dependencies should not have any transitive dependencies.

The functional dependencies in R1(Emp_ID, Name, DeptID, Marketing, Date_Completed) is :

Emp_ID -> Name, DeptID, Marketing

This violates the transitive property. So, no table is created.

The functional dependencies in R2 (  Emp_ID , Salary) is :

Emp_ID -> Salary

The functional dependencies in R3 (Date_Completed, Course_Name, Course_ID) are :

Date_Completed -> Course_Name

Course_Name   ->  Course_ID

Here there is a transitive dependency as a non- prime attribute ( Course_Name ) is determining a non-attribute ( Course_ID ).

So, a separate table is made with the concerned attributes.

The relational schemas which support 3NF re :

R1(Emp_ID, Name, DeptID, Course_ID, Marketing, Date_Completed) with candidate key as Emp_ID.

R2 (  Emp_ID , Salary) with candidate key Emp_ID.

R3 (Date_Completed, Course_Name ) with candidate key Date_Completed.

R4 ( Course_Name, Course_ID ).  with candidate keys Course_Name and Course_ID.

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.

Write a Python class named Rectangle constructed by a length and width. methods it should have Area()- this should return the area as a value Perimeter()- this should return the total of all the sides as a value Print()- this should print the rectangle such that "Length X Width" Should ask the user to enter the width and length

Answers

Answer:

class Rectangle:

   def __init__(self, length=1, width=1):

       self.length = length

       self.width = width

   def Area(self):

       return self.length * self.width

   def Perimeter(self):

       return 2 * (self.length + self.width)

   def Print(self):

       print(str(self.length) + " X " + str(self.width))

l = float(input("Enter the length: "))

w = float(input("Enter the width: "))

a = Rectangle(l, w)

print(str(a.Area()) + " " + str(a.Perimeter()))

a.Print()

Explanation:

Create a class called Rectangle

Create its constructor, that sets the length and width

Create a method Area to calculate its area

Create a method Perimeter to calculate its perimeter

Create a Print method that prints the rectangle in the required format

Ask the user for the length and width

Create a Rectangle object

Calculate and print its area and perimeter using the methods from the class

Print the rectangle

Answer:

class Rectangle():

   def __init__(self, l, w):

       self.len = l

       self.wi  = w

   def area(self):

     return self.len*self.wi

   def perimeter(self):

     return self.len+self.len+self.wi+self.wi

   def printing(self):

     print('{} Lenght X Width {}'.format(self.len, self.wi))

length = int(input("enter the length "))

width = int(input("enter the width "))

newRectangle = Rectangle(length, width)

newRectangle.printing()

print("Area is: ")

print(newRectangle.area())

print("The perimeter is: ")

print(newRectangle.perimeter())

Explanation:

The class rectangle is defined with a constructor that sets the length and width

As required the three methods Area, perimeter and printing are also defined

The input function is used to prompt and receive user input for length and width of the rectangle

An object of the Rectangle class is created and initalilized with the values entered by the user for length and width

The three methods are then called to calculate and return their values

Write a program that illustrates rethrowing an exception. Define methods CISP401Method and CISP401Method2. Method CISP401Method2 should initially throw an exception. Method CISP401Method should call CISP401Method2, catch the exception and rethrow it. Call CISP401Method from method main, and catch the rethrown exception. Print the stack trace of this exception.

Answers

Answer:

See explaination

Explanation:

The code here:

import java.io.*;

public class CISP401V11A5 {

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

try {

CISP401Method();

} catch (Exception e) {

System.out.println("Exception thrown in " + e.getStackTrace()[0].getMethodName() + "\n");

StringWriter sw = new StringWriter();

e.printStackTrace(new PrintWriter(sw));

String exceptionAsString = sw.toString();

String bagBegin = exceptionAsString.substring(0, 19);

String bagEnd = exceptionAsString.substring(19);

System.out.println(bagBegin + ": Exception thrown in " + e.getStackTrace()[0].getMethodName() + bagEnd);

}

}

public static void CISP401Method() throws Exception {

try {

CISP401Method2();

} catch (Exception e) {

throw e;

}

}

public static void CISP401Method2() throws Exception {

throw new Exception();

}

}

See attachment for sample output

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

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).

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:

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

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

Which example task should a developer use a trigger rather than a workflow rule for?
A. To set the primary contact on an account record when it is saved
B. To notify an external system that a record has been modified
C. To set the name field of an expense report record to expense and the date when it is saved
D. To send an email to a hiring manager when a candidate accepts a job offer

Answers

Answer:

A. To set the primary contact on an account record when it is saved

Explanation:

After updating a Contact and then you set the Primary checkbox, the contact becomes the primary contact and this then updates the reference in the Parent Account. Triggers are used for this purpose and not workflow rule. In this case there is only one contact at a time that is set as Primary Contacts, and in the case where an Account does not have any Contacts, the first contact that is created is made the primary and the trigger sets that value in reference.

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.

Use greedy approach to implement fractional knapsack problem. a. Ask user for knapsack capacity. b. Ask user for n objects weights and profits or read an input.txt that contains n objects weights and profits. c. List objects that maximize the profit and show the maximum profit as output considering knapsack capacity.

Answers

Answer:

see explaination

Explanation:

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package knapsack;

import java.util.*;

/**

*

* atauthor Administrator

*/

public class MyKnapsack {

static int max(int a, int b) { return (a > b)? a : b; }

static int calculate(int W, int wt[], int val[], int n)

{

if (n == 0 || W == 0)

return 0;

if (wt[n-1] > W)

return calculate(W, wt, val, n-1);

else return max( val[n-1] + calculate(W-wt[n-1], wt, val, n-1),

calculate(W, wt, val, n-1)

);

}

public static void main(String[] args)

{

Scanner sc=new Scanner(System.in);

System.out.printf("|Enter value of capacity");

int Capacity =sc.nextInt();

System.out.printf("|Enter value of number of objects");

int n=sc.nextInt();

int profits[] = new int[n];

int weight[] = new int[n];

System.out.printf("|Enter values for profits");

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

{

profits[i]=sc.nextInt();

}

System.out.printf("|Enter values for weights");

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

{

weight[j]=sc.nextInt();

}

System.out.println(calculate(Capacity,weight, profits, n));

}

Note: change the at with the sign

}

. 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

a text file has student data such that each line of text has a student first name (a non-empty alphabetic string) followed by exam scores (non-negative integers) separated by spaces. the number of scores might be different for each student, and each student has at least one score. see studentdata1, student data2, and student data3 in the drive folder homework. define a function student_minmax(filename) that has one parameter, the name of the file that has the student data, and returns a dictionary. the dictionary has the student names as keys and, as values, a list of two scores, the min and max scores for that student. for example, the call student_minmax('studentdata1.txt') will return the dictionary: {'joe': [5, 10], 'sue': [7, 10]}.

Answers

Answer:

def student_minmax(filename):  

  """

      Description: Reads student names and finds min and max score

      Input: Name of the file that has the student data

      Output: Dictionary with name as key and value is a list with min and max values

  """

  # Dictionary that holds the results

  studentDict = {}

  # Opening and reading file

  with open(filename, "r") as fp:

      # Reading data line by line

      for line in fp:

          # Stripping new line

          line = line.strip()

          # Splitting into fields

          fields = line.split(' ')

          # Getting name and scores

          name = fields[0]

          scores = []

          scoresStr = fields[1:]

          # Converting to integer

          for score in scoresStr:

              scores.append(int(score))

          # Storing in dictionary

          studentDict[name] = []

          studentDict[name].append(min(scores))

          studentDict[name].append(max(scores))

         

  # Returning dictionary

  return studentDict  

 

# Testing function

resDict = student_minmax("d:\\Python\\studentMarks.txt")

# Printing dict

print(resDict)

Explanation:

Create a class that stores an array of usable error messages. Create an OrderException class that stores one of the messages. Create an application that contains prompts for an item number and quantity. Allow for the possibility of nonnumeric entries as well as out-of-range entries and entries that do not match any of the currently available item numbers. The program should display an appropriate message if an error has occurred. If no errors exist in the entered data, compute the user’s total amount due (quantity times price each) and display it.

Answers

Answer:

Check the explanation

Explanation:

Given below is the code for the question.

import java.util.*;

public class PlaceAnOrder

{

  public static void main(String[] args)

  {

      final int HIGHITEM = 9999;

      final int HIGHQUAN = 12;

      int code;

      int x;

      boolean found;

      final int[] ITEM = {111, 222, 333, 444};

      final double[] PRICE = {0.89, 1.47, 2.43, 5.99};

      int item;

      int quantity;

      double price = 0;

      double totalPrice = 0;

      Scanner input = new Scanner(System.in);

      try{

          System.out.print("Enter Item number: ");

          if(input.hasNextInt()){

              item = input.nextInt();

              if(item < 0)

                  throw new OrderException(OrderMessages.message[2]);

              if(item > HIGHITEM)

                  throw new OrderException(OrderMessages.message[3]);

             

              System.out.print("Enter Item quantity: ");

              if(input.hasNextInt()){

                  quantity = input.nextInt();

                 

                  if(quantity < 1)

                      throw new OrderException(OrderMessages.message[4]);

                  if(quantity > HIGHQUAN)

                      throw new OrderException(OrderMessages.message[5]);

                  found = false;

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

                      if(ITEM[i] == item){

                          found = true;

                          totalPrice = PRICE[i] * quantity;

                          break;

                      }

                  }

                  if(!found)

                      throw new OrderException(OrderMessages.message[6]);

                  System.out.println("Total Amount due: $" + totalPrice);

              }

              else

                  throw new OrderException(OrderMessages.message[1]);

          }

          else

              throw new OrderException(OrderMessages.message[0]);

      }catch(OrderException e){

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

      }

  }

}

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!!

If I asked you to design a client server application that would work as a progressive slot machine (if you don't know what that is look it up before proceeding) client server application...what three choices would you make for that, why? Is the design much different from the time synchronization server?

Answers

Answer:

Explanation:

Iterative vs Concurrent:

An iterative server handles both the association demand and the exchange engaged with the call itself. Iterative servers are genuinely straightforward and are reasonable for exchanges that don't keep going long.

Be that as it may, if the exchange takes additional time, lines can develop rapidly, when Client A beginnings an exchange with the server, Client B can't make a call until A has wrapped up.

In this way, for extensive exchanges, an alternate kind of server is required — the simultaneous server, Here, Client A has just settled an association with the server, which has then made a youngster server procedure to deal with the exchange. This permits the server to process Client B's solicitation without trusting that An's exchange will finish. Beyond what one youngster server can be begun along these lines. TCP⁄IP gives a simultaneous server program called the IMS™ Listener.

Some idea on on time synchronization is Synchronization of Clocks: Software-Based Solutions

Techniques:

1.time stamps of real-time clocks

2.message passing

3. round-trip time (local measurement)

4.Cristian’s algorithm

5.Berkeley algorithm

6.Network time protocol (Internet)

A system time server isn't something numerous entrepreneurs consider, and timekeeping is generally not a need for organize executives. In any case, legitimate system time synchronization is a fundamental piece of checking a system and settling issues inside it.

Which of the following is not regression test case? A. A representative sample of tests that will exercise all software functions B. Additional tests that focus on software functions that are likely to be affected by the change C. Tests that focus on the software components that have been changed D. Low-level components are combined into clusters that perform a specific software sub-function

Answers

Answer:

D. Low-level components are combined into clusters that perform a specific software sub-function

Explanation:

Normally, regression testing are done on a manual basis by simply re-executing a subset of the entire available test cases or it can be done automatically by utilizing playback tools or automated capture. Hence, from the options, a combination of low-level components into clusters that perform a specific sub-function does not align with how regression testing are done either manually or automatically.

Low-level components are combined into clusters that perform a specific software sub-function. Thus option D is correct.

What is a regression test?

Regression testing is a statistical method of finding the relation between variables and is done by use of software such as functional and non-functional. It ensures that the development  of the software are made by utilizing playback tools or capture.

Thus, the options, are a combination of the low-level components into the clusters that perform specific sub-functions.

Find out more information about the regression.

brainly.com/question/13676957.

(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.

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 an application for a condo owner on a Florida Beach. The owner wants an application to be able to accept the season for the rental and the amount of days of the customer wishes to rent the condo. Based on each, the application will determine a final price for the rental.

Answers

Answer:

in_season_price = 120.0

off_season_price = 70.0

price = 0

season = input("Which season you plan to rent \"IN/OFF\" season: ")

days = int(input("Enter the days you want to rent: "))

if season == "IN":

   price = in_season_price * days

elif season == "OFF":

   price = off_season_price * days

print("Rental price is: " + str(price))

Explanation:

Set the prices for in and off season

Ask the user to choose the season and number of days they want to stay

Depending on the user choice calculate the price, multiply the season price with the number of days

Print the total price

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

                           

• 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)

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.

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.

Write a calculator program that keeps track of a subtotal like real calculators do. Start by asking the user for an initial number. Inside a loop, asks the user for a mathematical operation and a second number. Do the operation with the first number on the second number. Keep track of the result as a 'subtotal' to be used as the first number when going back to the top of the loop. When the user quits, print out the final result and quit the program. See output for an example for the behavior of the program. The operations should be at least

Answers

Answer:

num1 = float(input("Enter the first number: "))

while True:

   print("Add, Subtract, Multiply, Divide, or Quit ?")

   choice = input("Your choice is: ")

   if choice == "Quit":

       break

   num2 = float(input("Enter the second number: "))

   if choice == "Add":

       num1 += + num2

       print("The subtotal is: " + str(num1))

   elif choice == "Subtract":

       num1 -= num2

       print("The subtotal is: " + str(num1))

   elif choice == "Multiply":

       num1 *= num2

       print("The subtotal is: " + str(num1))

   elif choice == "Divide":

       num1 /= num2

       print("The subtotal is: " + str(num1))

print("The final result is: " + str(num1))

Explanation:

Ask the user for the first number

Create a while loop that iterates until specified condition occurs inside the loop

Ask the user for the operation or quitting

If the user chooses quitting, stop the loop. Otherwise, get the second number, perform the operation and print the subtotal

When the loop is done, the user enters Quit, print the final value result

) Suppose algorithm A takes 10 seconds to handle a data set of 1000 records. Suppose the algorithm A is of complexity O(n2). Answer the following: (i) Approximately how long will it take to handle a data set of 1500 records? Why? (ii) How long will it take to handle a data set of 5000 records? Can you come up with a reason why this will not be entirely accurate but will just be an approximation?

Answers

Answer:

i) The time taken for 1500 records = 15 seconds.

ii) The time taken for 1500 records = 50 seconds.

Explanation:

A is an O(n) algorithm.

An algorithm with O(n) efficiency is described as a linearly increasing algorithm, this mean that the rate at which the input increases is linear to the time needed to compute that algorithm with n inputs.

From the question, it is given that for 1000 records, the time required is: 10 seconds.

Algorithm time taken is O(n)

Hence,

1) For 1,500 records

=> 10/1000 = x/1500

=> 10x1500/1000 = x

x = 15 seconds

Thus, the time taken for 1500 records = 15 seconds.

2) For 5,000 records

=> 10/1000 = x/5000

=> 10x5000/1000 = x

x = 50 seconds

Thus, the time taken for 1500 records = 50 seconds.

Other Questions
No quiero salir. Me gustara estar en la casa, pap.S, me gustara jugar a los juegos de mesa ________. contigo nuestra nuestro conmigo The boundary of a field is a right triangle with a straight stream along its hypotenuse and with fences along its other two sides. Find the dimensions of the field with maximum area that can be enclosed with 1000 feet of fencing.(Must show work to back up your answer). A=1/2 bh My co-worker Larry only likes numbers that are divisible by 4, such as 20, or 4,004. How many different ones digits are possible in numbers that Larry likes? what was alexander the great's goal? was it conquering the world or just simply defeating Persia? I'm very confused about what he truly wanted to do. Bank A charger a 4$ service fee and $0.25 for each check written. Bank B charges $5 and $0.20 for each check written . How many checks does a person need to write each month for the two banks to charge the same amounts in fees. Which account would cost less if a person were to write 10 checks in a month? show all work 8x+38=-3(-6-4x) Features in currency in Ancient Rome write 3 answers PLZ HELP A chemist dissolves an ionic compound in water. The vapor pressure of the solution is _____. less than the vapor pressure of pure water equal to the vapor pressure of pure water greater than the vapor pressure of pure water A circular plate has circumference 23.9 inches. What is the area of this plate? A process is normally distributed and in control, with known mean and variance, and the usual three-sigma limits are used on the control chart, so that the probability of a single point plotting outside the control limits when the process is in control is 0.0027. Suppose that this chart is being used in phase I and the averages from a set of m samples or subgroups from this process are plotted on this chart. What is the probability that at least one of the averages will plot outside the control limits when m The first map shows colonial powers and their holdings (1945). the second map shows human development worldwide. compare the two maps. what do the maps indicate about regions that gained independence in the second half of the twentieth century? Which type of selection allows for the middle phenotypes to have increased fitness During a 12-hour period, the temperature in a city dropped from a high of 66F to a low of 29F. What was the range of the temperatures during this period? A circle has a radius of 6. An arc in this circle has a central angle of 48 degrees. What is the length of the arcWrite an exact, simplified answer in terms of pi. Suppose MR = MC = $3 at an output level of 2,000 units. If a monopolist produces and sells 2,000 units, charging a price of $6 per unit and incurring average total cost of $4 per unit, the monopolist will earn profit equal to _______. Ryan mows lawns in the summer. He charges $15 for every 1/2 hour of mowing. This is represented by the equation y = 15x, where y is the total amount Ryan charges and x is the number of 1/2 -hour sessions of mowing. If mr.smith lawn takes 2 hours to mow and mrs.jones lawn 3.5 hours to mow, how much more would Ryan charge mrs Jones then me.smuth A sharecropper in the South usually needed to:OA. supply his own tools.OB. rely on land he owned to grow his food.OC. supply his own animals.OD. let the landowner decide what to plant. 2. Read the second speech. Does Wilson think the United States should enter WWI? Why orwhy not? Members of the pep club were selling raffle tickets for $1.50 and $5. The number of $1.50 tickets sold was two less than four times the number of $5 tickets sold, and the club raised $1,152 from the ticket sales. Let x represent the number of $1.50 tickets sold and let y represent the number of $5 tickets sold. Solve the system of equations to determine how many of each ticket were sold. 1.5x + 5y = 1152 x = 4y 2 Which one-variable linear equation can be formed using the substitution method? How many $5 raffle tickets were sold? Which equation can be used to determine how many $1.50 raffle tickets were sold? How many $1.50 raffle tickets were sold? What do you need to do to be an active reader?OA. Relate your long-term goals to your readingOB. Ask questions and make commentsOC. Keep your prior knowledge in mind at all timesOD. Balance your social life with your studies