Define three integer variables (number1, number2, and number3). We also define two other storage spaces for storing sum as well as averageValue. The storage space (sum) is used to store the sum of three integer numbers. The storage space (averageValue) is used to store the average of the three numbers.
***************************************************************************************/
#include <stdio.h> // standard input and output functions library
#include <stdlib.h> // include library to execute command (system ("pause"); )
/*
The purpose of this program is to calculate the average of three
numbers
*/
int main ( void )
{ // Program start here
int number1, number2, number3, averageValue;
int sum ;
number1= 35; // assign value to number1
number2= 45; //assign value to the number2
number3 = 55; // assign value to the number3
sum = number1+ number2+ number3; // add all three numbers
averageValue = sum / 3 ;
fprintf(stdout, "\n\n\t\tValue of first number
is:\t%d", number1);
// %d is format specifier to represent number1
fprintf(stdout, "\n\n\t\tValue of second number
is:\t%d", number2);
// %d is format specifier to represent number2
fprintf(stdout, "\n\n\t\tValue of third number
is:\t%d", number3);
// %d is format specifier to represent number3
/*
Print sum and average values of these numbers
*/
fprintf(stdout, "\n\n\t\tSum of three Numbers
is:\t%d", sum);
// prints the sum of three numbers
fprintf (stdout, "\n\n\t\tAverage of three numbers
is:\t%d", averageValue);
// prints the average of three numbers
fprintf(stdout,"\n\n"); // bring the cursor on the new
line
system("pause"); // this statement holds the display until any key is pressed
} // end of program
Type the source code given above. The output of the
application is given below:
(Change the background of the display to white – this saves
black ink for printing)
The output of your program must look as shown
above.
Calculate sum and average manually (calculator) for these three
numbers (26, 35 and 45);
Sum : ________________
Average : ________________
What is the difference in actual value as well as the value calculated by C application?
If the two values are different, why are they different?
Make the relevant changes in the program so that the
values displayed are correct.
Show what changes are made in the program.
Exercise: 2:
Objective:
Purpose of this assignment is to learn use of reading and writing
data into specific format.
Use of fprintf or printf statements
a. Use of escape sequence in C Programming
b. Use of different variables
c. Use of format specifier
/****************************************************************************************
Name : Enter your Name here and Student # : Student number
Date:
*****************************************************************************************/
#include <stdio.h> // Directive to include the standard input/output library
int main (void)
{ // Program begins here
//Define data type variable here
int books_quantity;
float book_price;
float total_amount;
char name_initial;
// Print my name and student number
fprintf(stdout, "\n\t\t\t\tName:\t\t\\tYour Name\n\t\t\t\tStudent Number:\t\\tYour student Number");
// Now print message to enter quantity of books
printf ("\n Enter the quantity of books:\t\t");
// read the quantity of books
scanf("%d", &books_quantity);
// print the message to enter price of each book
fprintf(stdout, "\n\n Enter the price per book:\t\t$");
// read the price per book
scanf ("%f", &book_price);
// print the message to enter the initial of my first name
fprintf (stdout, "\n\n Enter the initial of your first name:\t\t");
// Before reading a character ensure that keyboard
buffer does not have any
// redundant characters
fflush (stdin);
// Now read character representing your first name's initial
scanf("%c",&name_initial); // Calculate the total amount of books
total_amount = book_price * books_quantity; // Now Display all values
printf ("\n\n Quantity of Books:\t\t%d",
books_quantity);
printf ("\n\n Price per book:\t\t$%.2f", book_price);
fprintf (stdout, "\n\n Total Amount of all the Books: $%.2f",
total_amount);
fprintf(stdout, "\n\n Initial of First Name:\t\t %c",
name_initial);
// flush any redundant character in the keyboard buffer
fflush(stdin); // hold the display
getchar(); // All ends well so return 0
return 0;
} // main block ends here
Attach your output here after building the application
and execute the program – attach the output of your application
below:
Now comment out the first fflush(stdin); (or remove
the fflush(stdin) )statement in the application. Rebuild the code
and execute the application. Input the data and attach the output
of your application below:
What do you observe? What happened when fflush(stdin);
was commented/removed?
Remove comment (//) (or add the first fflush(stdin);
statement) from the first fflush(stdin); statement. Comment out the
second fflush(stdin); (or remove statement (the statement just
before the getchar() statement).
Rebuild your application, execute the application and enter the
relevant inputs. What is your observation and explain? Attach your
output now.
In: Computer Science
II.We discussed the following table in the lecture/presentation. Just for your own practice, try filling out the columns for each:
Quantity Fixed Cost Variable Cost Total Cost Average Fixed Cost
Average Variable Cost Average Total Cost
Marginal Cost
1 100 10
2 100 15
3 100 25
4 100 40
5 100 60
6 100 85
7 100 115
8 100 150
9 100 190
10 100 235
Following are the questions you should be able to answer:
1.What happens to Average Fixed Cost as quantity
increases?
2.What happens to Average Variable Cost as quantity
increases?
3.What happens to Average Total Cost as quantity increases?
4.What is the distance between Average Variable Cost and Average
Total Cost?
5.What is the shape of Average Total Cost? Why is it shaped that
way? (In other words, what is going on until Q=7? What happens
after Q=7?)
6.What is the relationship between Marginal Cost and Average Total
Cost?
7.What is the relationship between Marginal Cost and Average
Variable Cost?
8.What happens to Average Total Cost in the Long Run? What is the
shape? Why?
In: Economics
Please in C++ thank you! Please also include the screenshot of the output. I have included everything that's needed for this. Pls and thank you!
Write a simple class and use it in a vector.
Begin by writing a Student class. The public section has the following methods:
Student::Student()
Constructor. Initializes all data elements: name to empty string(s), numeric variables to 0.
bool Student::ReadData(istream& in)
Data input. The istream should already be open. Reads the following data, in this order:
• First name (a string, 1 word)
• Last name (also a string, also 1 word)
• 5 quiz scores (integers, range 0-20)
• 3 test scores (integers, range 0-100)
Assumes that all data is separated by whitespace. The method returns true if reading all data was successful, otherwise returns false. Does not need to validate or range-check data; if one of the quiz or test scores is out of range, just keep going.
bool Student::WriteData(ostream& out) const
Output function. Writes data in the following format. Each student’s data is on one line.
• First name (left justified, 20 characters)
• Last name (left justified, 20 characters) • 5 quiz scores (each right justified in a field 4 characters wide)
• 3 test scores (each right justified in a field 5 characters wide)
• new-line character ‘\n’ or use of endl in output function
Note that this is a const method; it should not modify any of the object’s data. Returns true if the attempt to send the data to the stream was successful, false otherwise.
string Student::GetFirstName() const;
string Student::GetLastName() const;
Accessor methods, also known as ‘getters.’ Returns data from inside the function.
float Student::CourseAverage() const
Returns the student’s weighted average as a percentage (float in range 0-100). The quiz scores are averaged together (20-point scale) and are 35% of the course grade. The test are averaged together and are 65% of the course grade. This does not modify any of the object’s data.
bool Student::DisplayCourseAverage(ostream& out) const Prints the student’s course average to the provided output stream, rounded to 3 decimal places. Returns true if the attempt was successful, false otherwise.
string Student::LetterGrade() const Returns a string with the student’s letter grade, using the same grading scale as this course. The class should assume that any input or output streams passed to public methods are already open.
The main program is quite simple. You are provided a data file with data for some number of students. Read the data into a vector. (Hint: Declare one student. Read that student’s data, then add it to the vector. Repeat.) It should then print a roster, showing the name, course average to 3 decimal places, and letter grade for each student in the course. This list should be sorted by student name (sort by last name, break ties using first name; display in usual first-name last-name order).
Here is the input.txt
23
MIRANDA BOONE 17 17 13 17 20 86 91 71
LARRY MARSH 16 11 20 15 11 78 82 96
JANIE FOWLER 18 18 19 18 20 80 90 69
ALBERTO GILBERT 15 20 18 17 19 51 76 99
SUE LEONARD 12 15 12 18 17 85 77 100
CARL BALLARD 16 12 16 16 20 65 80 92
LESLIE PEREZ 13 18 17 12 20 81 81 96
MORRIS NEWTON 20 19 19 20 16 75 80 66
BRANDI LAMB 19 17 20 12 16 97 67 65
HERBERT HARVEY 20 16 11 14 12 80 100 80
RUDOLPH FISHER 17 18 20 18 18 82 68 77
LAURIE PHELPS 18 11 13 16 15 90 93 76
PHILIP ZIMMERMAN 17 13 18 16 18 79 78 64
BRAD HAYES 17 20 13 11 20 81 92 87
BELINDA JACKSON 18 10 16 18 16 59 76 87
JESSIE MORAN 16 14 13 19 19 78 79 66
BRIDGET KELLER 19 14 15 20 20 90 66 66
CHAD RODRIGUEZ 15 16 20 18 18 86 71 79
KENNETH KELLY 11 19 17 19 18 76 75 67
CASSANDRA MASON 14 20 18 20 17 85 76 100
RANDY JACKSON 18 19 15 19 17 67 61 65
GARRY CLAYTON 10 16 18 14 19 86 85 84
NICK FLOYD 18 13 20 17 16 79 76 81
In: Computer Science
3.1. Carefully explain the following observations:
(i) Silver dissolves poorly in copper at 100°C.
(ii) Copper dissolves poorly in silver at 100°C.
(iii) The amount of copper (in atom per cent) that can dissolve in silver at 100°C is greater than the amount of silver (in atom per cent) that can dissolve in copper at 100°C.
In: Chemistry
The following are the cash flows of two projects: Year Project A Project B 0 ?$ 220 ?$ 220 1 100 120 2 100 120 3 100 120 4 100 If the opportunity cost of capital is 10%, what is the profitability index for each project? (Do not round intermediate calculations. Round your answers to 4 decimal places.)
In: Finance
Shelly Herzog opens a research service near a college campus. She names the corporation Herzog Researchers, Inc. During the first month of operations, July 20X3, the business engages in the following transactions:
a. Herzog Researchers, Inc., issues its common stock to Shelly Herzog, who invests $25,000 to open the business.
b. The company purchases on account office supplies costing $350.
c. Herzog Researchers pays cash of $20,000 to acquire a lot next to the campus. The company intends to use the land as a building site for a business office.
d. Herzog Researchers performs research for clients and receives cash of $1,900.
e. Herzog Researchers pays $100 on the account payable it created in transaction b.
f. Herzog pays $2,000 of personal funds for a vacation.
g. Herzog Researchers pays cash expenses for office rent ($400) and utilities ($100).
h. The business sells a small parcel of the land for its cost of $5,000.
i. The business declares and pays a cash dividend of $1,200.
Required
1. Analyze the preceding transactions in terms of their effects on the accounting equation of Herzog Researchers, Inc. Use Exhibit 2-1, Panel B as a guide.
2. Prepare the income statement, statement of retained earnings, and balance sheet of Herzog Researchers, Inc., after recording the transactions. Draw arrows linking the statements.
In: Accounting
First part of the question: Eighteen-year-old Linus is thinking about taking a five-year university degree. The degree will cost him $25,000 each year. After he's finished, he expects to make $50,000 per year for 10 years, $75,000 per year for another 10 years, and $100,000 per year for the final 10 years of his working career. All these values are stated in real dollars. Assume that Linus lives to be 100 and that real interest rates will stay at 5% per year throughout his life.
Linus is also considering another option. If he takes a job at the local grocery store, his starting wage will be $40,000 per year, and he will get a 3% raise each year, in real terms, until he retires at the age of 53. Assume that Linus lives to be 100.
i. Calculate the present value of Linus’s lifetime earnings, using a spreadsheet or using the growing annuity formula. You can find the formula in the lesson notes, at the end of Note 7 in Lesson 4. (1 mark)
ii. Use that value to determine Linus’s permanent income, i.e., how much can Linus spend each year equally over the rest of his life? (1 mark)
c. Do you think Linus is better off choosing option a. or option b.? Consider both financial and non-financial measures.
In: Economics
A financial institution has the following market value balance
sheet structure:
| Assets | Liabilities and Equity | ||||||
| Cash | $ | 2,400 | Certificate of deposit | $ | 11,400 | ||
| Bond | 10,200 | Equity | 1,200 | ||||
| Total assets | $ | 12,600 | Total liabilities and equity | $ | 12,600 | ||
a. The bond has a 10-year maturity, a fixed-rate
coupon of 12 percent paid at the end of each year, and a par value
of $10,200. The certificate of deposit has a 1-year maturity and a
6 percent fixed rate of interest. The FI expects no additional
asset growth. What will be the net interest income (NII) at the end
of the first year? (Note: Net interest income equals
interest income minus interest expense.)
b. If at the end of year 1 market interest rates
have increased 100 basis points (1 percent), what will be the net
interest income for the second year? Is the change in NII caused by
reinvestment risk or refinancing risk?
c. Assuming that market interest rates increase 1
percent, the bond will have a value of $9,677 at the end of year 1.
What will be the market value of the equity for the FI? Assume that
all of the NII in part (a) is used to cover operating expenses or
is distributed as dividends.
d. If market interest rates had decreased
100 basis points by the end of year 1, would the market value of
equity be higher or lower than $1,200?
e. What factors have caused the changes in
operating performance and market value for this FI?
In: Accounting
Consider the following sample of exam scores, arranged in increasing order. DO IT BY HAND AND SHOW WORK. NO WORK NO CREDIT. MAKE SURE YOU USE THE FORMULAS IN CLASS NOTES TO FIND LOCATION FOR PERCENTILES/QUARTILES. THE TEXTBOOK USES A DIFFERENT APPROACH AND RESULTS WILL BE DIFFERENT!
28 57 58 64 69 74 79 80 83 85 85 87 87 89 89 90 92 93 94 94 95 96 96 97 97 97 97 98 100 100
(Hint: the sample mean of these exam scores is 85)
Determine the interquartile range (IQR).
Obtain the five number summary.
Identify potential outliers if any.
Construct and interpret a boxplot or if appropriate, a modified boxplot.
4. Using the data in question 3 above, use Excel to
Determine the frequency distribution of exam scores. Use cutpoint grouping with
25 as the first cutpoint and classes of equal width 5.
Determine the relative frequency distribution of exam scores
Find the following descriptive statistics of the exam scores using excel functions:
Sample size (count), Mean, Variance, Standard Deviation, Minimum, Maximum, Range, Summation of observations in sample (sum), Mode, Median, Lower quartile-Q1, Middle quartile-Q2 (same as median), upper quartile-Q3 and Inter- quartile Range (IQR).
In: Statistics and Probability
Please explain the solution to this problem to me conceptually as well as mathematically. I'd like to fully understand the transactions and the logic behind them. Thank you.
In year 1, Rim Corporation purchases 1,000 shares of treasury stock for $10 per share. In year 2, Rim reissues 100 shares of treasury stock for $12 per share. In year 3, Rim reissues 500 shares of its treasury stock for $9 per share. The journal entry to record the reissuance of treasury stock in year 3 will include which of the following entries?
Select all that may apply.
Credit paid-in-capital treasury shares for $500
Debit paid-in-capital treasury shares for $500
Debit paid-in-capital treasury shares for $200
Debit retained earnings for $300
Here is the solution:
| Account names and explanations | Dr. | Cr. |
| Cash (500 shares x $9) | $4,500 | |
| Paid-in-capital treasury shares (100 x 2) | $200 | |
| Retained earnings ((10-9)x500-200) | $300 | |
| Treasury stock (500 x $10) | $5,000 |
First off, what are the relationships between treasury stock, retained earnings, and paid-in-capital treasury?
Secondly, how was the paid-in-capital and retained earnings journal entries calculated? What is the logic behind it?
Please explain it in a simple way.
Thanks!
In: Accounting