Questions
Arrays provide the programmer the ability to store a group of related variables in a list...

Arrays provide the programmer the ability to store a group of related variables in a list that can be accessed via an index. This is often very useful as most programs perform the same series of calculations on every element in the array. To create an array of 10 integers (with predefined values) the following code segment can be utilised:

int valueList[10] = {4,7,1,36,23,67,61,887,12,53};

To step through the array the index '[n]' need to be updated. One method of stepping through the array is via a 'for' loop. Based on the array ‘valueList’ create a small C++ application utilising a 'for' loop that steps through the array and determines the largest number in the list and prints out the index and value. Hint: Consider creating an integer that stores the current largest integer and then compares it with the next indexed value.

In: Computer Science

SHORT ANSWER __________ refers to those attributes of a system visible to a programmer. 2. _________...

SHORT ANSWER

  1. __________ refers to those attributes of a system visible to a programmer.

2. _________ refers to the operational units and their interconnections that realize the architectural specifications.

3. Control signals, interfaces between the computer and peripherals, and the memory technology used are all examples of _________ attributes.

4. The instruction set, the number of bits used to represent various data types, I/O mechanisms and techniques for addressing memory are all examples of _________ attributes.

  1. The __________ architecture is the architecture of IBM’s mainframe product line.
  2. _________ is the way in which the components are interrelated.
  3. _________ is the operation of each individual component as part of the structure.
  4. The basic functions that a computer can perform are: data processing, data movement, control, and _________.
  5. When data are received from or delivered to a device that is directly connected to the computer, the process is known as __________.
  6. The four main structural components of the computer are: main memory, I/O, system interconnection, and __________.
  7. Often referred to as processor the ________ controls the operation of the computer and performs its data processing functions.
  8. A common example of system interconnection is by means of a ________, consisting of a number of conducting wires to which all the other components attach.
  9. The major structural components of the CPU are: control unit, register, CPU interconnection, and __________.
  10. A __________ control unit operates by executing microinstructions that define the functionality of the control unit.
  11. The _________ controls the operation of the CPU and hence the computer.

Problems:

  1. A program consists of 100,000 instructions as follows:

Instruction Type

Instruction Count

Cycles per Instruction

Integer arithmetic

45,000

4

Data transfer

32,000

6

Floating point arithmetic

15,000

10

Control transfer

8,000

3

1) Determine

  1. the program execution time,
  2. the effective CPI for the machine,
  3. MIPS rate for the following processors.

*Please show work for each answer placed in the Table.

Processor

Execution Time

CPI

MIPS rate

M1 - 350 MHz

M2 - 800 MHz

M3 - 1 GHz

2) What is the speed up of M2 from M1?

3) what is the speed up of M3 from M1?

4) What is the speed up of M3 from M2?

  1. Consider two different machines with two different instruction sets, both of which have a clock rate of 400 MHz. The following measurements are recorded on the two machines running a given set of benchmark programs.

Instruction Type

Instruction Count (millions)

Cycles per

Instruction

Machine A

Arithmetic and logic

Load and store

Branch

Others

8

4

2

4

1

3

4

3

Machine B

Arithmetic and logic

Load and store

Branch

Others

10

8

2

4

1

2

3

4

  1. Determine
    1. the program execution time,
    2. the effective CPI for the machine,
    3. MIPS rate for each machine.

*Please show work for each answer in the Table.

Processor

Execution Time

CPI

MIPS rate

Machine A

Machine B

2) Comment on the result.

  1. We have two types of machine as follows:

Processor

Clock Rate (MHz)

MIPS rate

CPU time (sec)

Machine A

5

1

12 x

Machine B

25

18

x

Mache A requires 12 times longer than Machine B measured in CPU time. For example, a program takes 1 second in Machine B will take 12 seconds.

1) What is the relative size of the instruction count for the program running on the two machines?

2) What is the effective CPI for the two machines?

In: Computer Science

// Programmer: // Date: // The Saurian class has the ability to translate English to Saurian...

// Programmer:
// Date:
// The Saurian class has the ability to translate English to Saurian
// and Saurian to English

public class Saurian
{
   // data

   // constants used for translating
   // note M = M and m = m so M and m are not needed
   public static final char[] ENGLISHARR = {'A','B','C','D','E','F','G','H','I','J','K','L','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','n','o','p','q','r','s','t','u','v','w','x','y','z'};
   public static final char[] SAURIANARR = {'U','R','S','T','O','V','W','X','A','Z','B','C','D','E','F','G','H','J','K','I','L','N','P','O','Q','u','r','s','t','o','v','w','x','a','z','b','c','d','e','f','g','h','j','k','i','l','n','p','o','q'};
   public static final int ARRLENGTH = ENGLISHARR.length;   // should be the same length for ENGLISHARR and SAURIANARR

}

In: Computer Science

Having trouble getting started on this Overview As a programmer, you have be asked by a...

Having trouble getting started on this

Overview

As a programmer, you have be asked by a good friend to create a program that will allow them to keep track of their personal expenses. They want to be able to enter their expenses for the month, store them in a file, and then have the ability to retrieve them later. However, your friend only wants certain people to have the ability to view his or her expenses, so they are requesting that you include some sort of login functionality.

Instructions

For this challenge, you will start this application for your friend by concentrating on the login functionality. You will have a standard report in a text file where you will build login functionality to access. Below you will find the step by step instructions on how to develop this application.

  1. Declaring Variables - You will start the application by declaring the following variables:
    1. username - initialized with an empty string to store the username entered by the user
    2. password - initialized with an empty string to store the password entered by the user
    3. repeat - initialized with the letter 'y' to control the looping of the program
    4. passwordLength - intialized with the number 8 to validate password length
    5. Four flags set to false named hasAmpersand, hasValidLength, isValidUsername, and isValidPassword
  2. Display the program header as shown in the images below
  3. Your program must allow the program to repeat without re-displaying the program header.
  4. You must obtain the username from the user then check to see if the username contains the @ symbol. If does, set the hasAmpersand flag to true and allow the program to continue. If it doesn't, alert the user that it is an invalid email and use the continue command to skip the rest of the code and repeat the program.
  5. Obtain the user password and use a while loop to make sure that the user has entered a password greater than the number stored in the passwordLength variable. After the password has been validated to be greater than the stated password length, change the hasValidLength flag to true.
  6. You will then use the hasAmpersand and hasValidLength flags to confirm whether or not to open the logins.txt file to confirm that this login information is present in the file. This is when you would change the appropriate isValid flags to state that they are in the file. (HINT: You can check first that the username is in the file, if not, then there is no need to check for the password.) If the username is not in the file, use the break statement to end the program as shown below.
  7. The report stored in the PersonalExpense.txt file should only be display if both the username and password is correct.
  8. The text files for this application are attached to the Dropbox. You may download and add them to your solution. Or feel free to create your own login and report pages

what I have so far:

hasAt=False

while (not hasAt):

username= input("what is your username?")

if "@" not in username:

print ("wrong username")

print ("try again loser")

else:

password= input ("what is your password?")

hasAt=True

In: Computer Science

1. True or False? If one programmer in a large team is given the task of...

1. True or False? If one programmer in a large team is given the task of writing a single function for the team project, this programmer is more likely to need a function driver than a function stub.

2. A(n) ____________________ is a dummy function that is included for testing the higher-level code.

3. ____________________ is the principle that a module should perform exactly one abstract action.

4.

For the function definition
int SomeFunc( /* in */ int alpha,
/* in */ int beta )
{
int gamma;
alpha = alpha + beta;
gamma = 2 * alpha;
return gamma;
}
what is the function postcondition?

a. // Postcondition: gamma == 2*alpha

b. // Postcondition: alpha == alpha@entry + beta
// && gamma == 2*alpha

c. // Postcondition: Function value == gamma

d. // Postcondition: Function value == 2*alpha

e. // Postcondition: Function value == 2*(alpha@entry + beta)

5. ____________________ is a measure of the quantity of information passing through a module's interface.

6. In contrast to promotion, ____________________ of data values can potentially cause loss of information.

7.

Using the library functions available through the header file cctype, which of the following can be used to determine if the variable someChar contains either a digit character or a lowercase letter?

a. if (isalnum(someChar) || isdigit(someChar))

b. if (isalpha(someChar) || isdigit(someChar))

c. if (isalnum(someChar) && !isupper(someChar))

d. if (islower(someChar) || isdigit(someChar))

e. c and d above

8. True or False? For team programming to succeed, it is essential that all of the module interfaces be defined explicitly and the coded modules adhere strictly to the specifications for those interfaces.

9.

Which of the following could cause an unexpected side effect?

a. modifying a global variable

b. changing the value of a value parameter

c. referencing a global constant

d. declaring an incoming-only parameter to be a reference parameter

e. a and d above

10. True or False? Unsigned types are most appropriate for advanced techniques that manipulate individual bits within memory within memory cells to avoid errors caused by, for example, using unsigned variables for ordinary numeric computations.

In: Computer Science

Write at least a 350 word posting in which you discuss the public interest theory and...

Write at least a 350 word posting in which you discuss the public interest theory and the special interest group theory as they relate to the Patient Protection and Affordable Care Act of 2010. Be sure to include in your discussion how each describes why the government intervenes in a market-based health care system and the role politicians play in each. After reading the postings of other students, select the one that provided you with information or a view you did not consider.

In: Economics

2. Let x be the number of years after 2007 and y represent the number of...

2. Let x be the number of years after 2007 and y represent the number of students enrolled at WWCC. Answer the following given the data that enrollment was 2055 in the year 2007, 2244 in 2008, 2512 in 2009, 2715 in 2010, and 2765 in 2011.

(a) Find the least-squares line for the data using Excel and submit your file in Canvas.

(b) Using partial derivatives, verify the formula you obtained in Excel.

(c) Find the least-squares error E

In: Statistics and Probability

1. The relationship National Saving = Y – C – G holds for: A closed economy...

1. The relationship National Saving = Y – C – G holds for:

A closed economy only

An open economy only

Either an open or closed economy

2. The relationship Saving = Investment holds for:

A closed economy only

An open economy only

Either an open or closed economy

3. True or false: a trade deficit implies a positive net capital outflow.

True
False


In: Economics

1) The worksheet Engines in the HW8 data workbook on Moodle describe a suppliers shipments of...

1) The worksheet Engines in the HW8 data workbook on Moodle describe a suppliers shipments of engines per year to their customers from 1999 through 2018.

a) Use simple regression with Shipments as the independent or Y variable and Year as the dependent or X variable to fit the data. Determine MAE, MSE and MAPE for the simple regression model. Construct a chart that has the observed data and the fit line by Year. Use the simple regression model to predict Shipments for years 2019 and 2020.

b) Use a three time period Moving Average to fit the rate data. Determine MAE, MSE and MAPE for the Moving Average model. Construct a chart that has the observed data and the fit line by Year. Use the Moving Average model to predict Shipments for years 2019 and 2020.

c) Use exponential smoothing with a smoothing constant of 0.15 to fit the data. Determine MAE, MSE and MAPE for the exponential smoothing model. Use the model to forecast Shipments for years 2019 and 2020.

d) Short answer. Which of the three above forecasting models (simple regression, moving average and exponential smoothing) would you use to model the data and why would you use that model.

Year Shipments
1999 157
2000 168
2001 186
2002 171
2003 198
2004 222
2005 246
2006 233
2007 342
2008 413
2009 517
2010 588
2011 600
2012 524
2013 384
2014 403
2015 522
2016 604
2017 815
2018 955

In: Statistics and Probability

The following condensed income statements of the Jackson Holding Company are presented for the two years...

The following condensed income statements of the Jackson Holding Company are presented for the two years ended December 31, 2021 and 2020:

2021 2020
Sales revenue $ 15,900,000 $ 10,500,000
Cost of goods sold 9,650,000 6,450,000
Gross profit 6,250,000 4,050,000
Operating expenses 3,560,000 2,960,000
Operating income 2,690,000 1,090,000
Gain on sale of division 690,000
3,380,000 1,090,000
Income tax expense 845,000 272,500
Net income $ 2,535,000 $ 817,500


On October 15, 2021, Jackson entered into a tentative agreement to sell the assets of one of its divisions. The division qualifies as a component of an entity as defined by GAAP. The division was sold on December 31, 2021, for $5,270,000. Book value of the division’s assets was $4,580,000. The division’s contribution to Jackson’s operating income before-tax for each year was as follows:

2021 $445,000
2020 $345,000


Assume an income tax rate of 25%.

Required: (In each case, net any gain or loss on sale of division with annual income or loss from the division and show the tax effect on a separate line.)
1. Prepare revised income statements according to generally accepted accounting principles, beginning with income from continuing operations before income taxes. Ignore EPS disclosures.
2. Assume that by December 31, 2021, the division had not yet been sold but was considered held for sale. The fair value of the division’s assets on December 31 was $5,270,000. Prepare revised income statements according to generally accepted accounting principles, beginning with income from continuing operations before income taxes. Ignore EPS disclosures.
3. Assume that by December 31, 2021, the division had not yet been sold but was considered held for sale. The fair value of the division’s assets on December 31 was $3,990,000. Prepare revised income statements according to generally accepted accounting principles, beginning with income from continuing operations before income taxes. Ignore EPS disclosures.

Assume that by December 31, 2021, the division had not yet been sold but was considered held for sale. The fair value of the division’s assets on December 31 was $3,990,000. Prepare revised income statements according to generally accepted accounting principles, beginning with income from continuing operations before income taxes. Ignore EPS disclosures. (Amounts to be deducted should be indicated with a minus sign.)

JACKSON HOLDING COMPANY
Comparative Income Statements (in part)
For the Years Ended December 31
2021 2020
Income from continuing operations before income taxes
Income from continuing operations 0 0
Discontinued operations gain (loss):
Income from discontinued operations
Net income $ $

In: Accounting