Exercise 12.1: Empowerment Profile
Step 1
Complete the following questionnaire. For each of the following items, select the alternative with which you feel more comfortable. While for some items you may feel that both (a) and (b) describe you or neither is ever applicable, you should select the alternative that better describes you most of the time.
When I have to give a talk or write a paper, I . . .
________
Base the content of my talk or paper on my own ideas.
________
Do a lot of research, and present the findings of others in my paper or talk.
When I read something I disagree with, I . . .
________
Assume my position is correct.
________
Assume what’s presented in the written word is correct.
When someone makes me extremely angry, I . . .
________
Ask the other person to stop the behavior that is offensive to me.
________
Say little, not quite knowing how to state my position.
When I do a good job, it is important to me that . . .
________
The job represents the best I can do.
________
Others take notice of the job I’ve done.
When I buy new clothes, I . . .
________
Buy what looks best on me.
________
Try to dress in accordance with the latest fashion.
When something goes wrong, I . . .
________
Try to solve the problem.
________
Try to find out who’s at fault.
As I anticipate my future, I . . .
________
Am confident I will be able to lead the kind of life I want to lead.
________
Worry about being able to live up to my obligations.
When examining my own resources and capacities, I . . .
________
Like what I find.
________
Find all kinds of things I wish were different.
When someone treats me unfairly, I . . .
________
Put my energies into getting what I want.
________
Tell others about the injustice.
When someone criticizes my efforts, I . . .
________
Ask questions to under-stand the basis for the criticism.
________
Defend my actions or decisions, trying to make my critic understand why I did what I did.
When I engage in an activity, it is very important to me that . . .
________
I live up to my own expectations.
________
I live up to the expectations of others.
When I let someone else down or disappoint them, I . . .
________
Resolve to do things differently next time.
________
Feel guilty, and wish I had done things differently.
I try to surround myself with people . . .
________
Whom I respect.
________
Who respect me.
I try to develop friendships with people who . . .
________
Are challenging and exciting.
________
Can make me feel a little safer and a little more secure.
I make my best efforts when . . .
________
I do something I want to do when I want to do it.
________
Someone else gives me an assignment, a deadline, and a reward for performing.
When I love a person, I . . .
________
Encourage him or her to be free and choose for himself or herself.
________
Encourage him or her to do the same thing I do and to make choices similar to mine.
When I play a competitive game, it is important to me that I . . .
________
Do the best I can.
________
Win.
I really like being around people who . . .
________
Can broaden my horizons and teach me something.
________
Can and want to learn from me.
My best days are those that . . .
________
Present unexpected opportunities.
________
Go according to plan.
When I get behind in my work, I . . .
________
Do the best I can and don’t worry.
________
Worry or push myself harder than I should.
Step 2
Score your responses as follows:
Total your (a) responses: ___________
Total your (b) responses: ___________
Reflect on the overall pattern of your a) and b) responses.
In: Operations Management
Please do this in C++ only. Please Show your code and your output too. Would you focus on number 2 in the Required functions:? Please use all the variables in the program.
The assignment problem:
You are asked to develop an application that prints a bank’s customers' names, IDs, and accounts balances in different ways. In this program, you need to read a file of customer’s data into different arrays, pass these arrays to functions as (array parameter), calculate the total balance for all customers, then print some information. The input file “input.txt” contains the following information (ID, first name, last name, savings account balance, checking account balance). You have to store these different columns in different arrays where each index represents customer data.
Preliminaries
1. We will consider the file contains 10 rows maximum. So all your arrays size must be at least 10.
2. Since the size of all the arrays is 10, so it is better to create a constant variable with the value 10 than hard coding the arrays size.
3. Create five different arrays with different types based on the data in the file (for ID, First, Last, saving, and checking)
4. Create a “switch” statement with four options and the output should be generated based on the chose option. Check the options below:
1. Print customer information
2. Print all customer Names ordered by their Last Name.
3. Print Bank’s total amount.
4. Enter q/Q to quit
Required functions:
1. A function “printCustomersData” should be called when the user chooses the first option. This function is of type void (it does not return anything). “printCustomersData” function should print a table of the customers data with the following order format: “LastName , First Name , ID , Saving Account, Checking Account.”
2. The function “printNames” will print the Names (first and last) of customers in alphabetic order by their last name.
3. The function “printBankTotal” that prints the summation of the balance of all customers saving account ($17410.31) and the summation of the balance of all customers checking accounts ($27430.01).
4. If the user entered something not in the options such as the
letter ‘a’, the application should not be terminated. Instead, the
application should print a message that tells the user that his/her
input was incorrect, then the options should be displayed again,
and the application should ask the user to enter another
option.
5. The Menu options will be printed after each selection. Even when the user enters an invalid value. The only way to terminate the program is to enter ‘q’ or ‘Q’ which is the fourth option.
Hints:
1. Create an “if” statement to check if the file reading process went well. You can use many expressions such as: (!fin) or (fin.fail()), etc.
2. Use the function “setw(number)” that helps you to print the data in a shape of table. This function sets the number of spaces for each output. The function is in the <iomanip> library.
3. Save the whole project and zip it before uploading it to Canvas. (Do not submit only the ‘.cpp’ file and do not copy and paste your code to a ‘.txt’ file or Word file).
This what you will have in the “input.txt”
10 Homer Smith 810.2 101.10
20 Jack Stanely 100.0 1394.90
30 Daniel Hackson 333.90 7483.77
40 Sara Thomson 1930.02 4473.20
50 Thomas Elu 932.0 2334.30
60 Sam Carol 33.0 0.0
70 Tina Jefferson 334.90 777.5
80 Wael Lion 8843.2 88.90
90 Carol Smith 3994.09 2343.30
100 Jack Carlton 99.0 8433.04
In: Computer Science
Estoppel:
The doctrine of estoppel may prevent the union or the employer
from relying
on and enforcing the terms of the collective agreement. Where a
party makes a
representation to the other, by way of words or conduct, indicating
that an issue will be
dealt with in a manner different from the provisions of the
agreement, the party who
made the representation will not be able to later insist upon the
collective agreement
being enforced.
Statements made by a party to the agreement could be the basis for
an estoppel. In one
case, a collective agreement provided that layoffs would occur in
reverse order of seniority.
The employer, a hospital, hired two laboratory technicians. The
hiring manager assured
both technicians when they were hired that they would not be laid
off because of funding
cuts or the return of other employees to the department. However,
the hospital laid off the
technicians 14 months after they were hired when other employees
returned to the bargaining
unit. When the employees objected, they were told that the
collective agreement was
clear on the question of seniority on layoffs and there was nothing
that could be done
because they had the least seniority. A grievance was filed, and
the arbitrator held that the
doctrine of estoppel applied.20 Because of the representations made
to the technicians
before they were hired, the employer could not rely on the
collective agreement, and the
layoff of the technicians was nullified.
Estoppel is a legal concept providing
that if a party makes a representation
that an issue will be dealt with in a
manner different from the provisions of
the collective agreement, it will not be
able to later insist upon the collective
agreement being enforced as written.
222 Chapter 9
The union and the employer should be alert to the possibility of
estoppel based on
conduct or past practice. In one case, the collective agreement
provided that certain benefits
would be paid to employees after a three-day waiting period.21
Despite the terms of the
collective agreement, the employer had a long-established practice
of paying employees
benefits during the three-day period. When the employer indicated
it would enforce the
three-day waiting period in the future, the union filed a grievance
relying on estoppel. The
arbitrator upheld the grievance and ordered the employer to
continue to pay the benefits
according to its practice for the balance of the term of the
agreement.
Similarly, a union might be caught by an estoppel argument based on
prior past practice
if it failed to enforce all the terms of the agreement. For
example, a collective agreement
will usually provide for a probationary period. If the employer
made a habit of
extending the period, in breach of the agreement, and the union
took no action, the union
may not be allowed to object to an extension of the period on the
basis of estoppel.22
An estoppel will not be established by a single failure to comply
with or enforce the
collective agreement; however, employers and unions should be aware
of the risk of
repeated failures to enforce a term of the agreement. An employer
who wanted to vary
from the collective agreement to deal with a short-term issue might
consider consulting
with the union and attempting to reach an agreement that would
prevent an estoppel
argument being raised when the employer wished to revert to the
terms of the agreement.
If the agreement provided for a rate of remuneration for employees
who drove their own
cars, and the price of gas increased significantly, an agreement
might allow the employer to
increase the mileage allowance for a time and avoid any possible
estoppel arguments later.
Estoppel does not mean that a party will be prevented from
enforcing the terms of the
agreement indefinitely. An estoppel will cease at the next round of
contract negotiations if
the union or the employer advises the other that it will rely on
the strict terms of the agreement
in the future. The party that has previously relied on the
variation from the collective
agreement will have to negotiate a change to the agreement. If it
fails to do so, it will be
deemed to have agreed to the application of the agreement as
written.
In your own words, describe the concept of "estoppel" and what significance it
has on the change process in a unionized work setting. (100 word target).
In: Operations Management
THE FISH I caught a tremendous fish and held him beside the boat half out of water, with my hook fast in a corner of his mouth. He didn't fight. He hadn't fought at all. He hung a grunting weight, battered and venerable and homely. Here and there his brown skin hung in strips like ancient wallpaper, and its pattern of darker brown was like wallpaper: shapes like full-blown roses stained and lost through age. He was speckled with barnacles, fine rosettes of lime, and infested with tiny white sea-lice, and underneath two or three rags of green weed hung down. While his gills were breathing in the terrible oxygen - the frightening gills, fresh and crisp with blood, that can cut so badly- I thought of the coarse white flesh packed in like feathers, the big bones and the little bones, the dramatic reds and blacks of his shiny entrails, and the pink swim-bladder like a big peony. I looked into his eyes which were far larger than mine but shallower, and yellowed, the irises backed and packed with tarnished tinfoil seen through the lenses of old scratched isinglass. They shifted a little, but not to return my stare. - It was more like the tipping of an object toward the light. I admired his sullen face, the mechanism of his jaw, and then I saw that from his lower lip - if you could call it a lip grim, wet, and weaponlike, hung five old pieces of fish-line, or four and a wire leader with the swivel still attached, with all their five big hooks grown firmly in his mouth. A green line, frayed at the end where he broke it, two heavier lines, and a fine black thread still crimped from the strain and snap when it broke and he got away. Like medals with their ribbons frayed and wavering, a five-haired beard of wisdom trailing from his aching jaw. I stared and stared and victory filled up the little-rented boat, from the pool of bilge where oil had spread a rainbow around the rusted engine to the bailer rusted orange, the sun-cracked thwarts, the oarlocks on their strings, the gunnels- until everything was rainbow, rainbow, rainbow! And I let the fish go. Questions on Elizabeth Bishop’s “The Fish” 1. Define the following words: venerable, barnacles, rosettes, sea-lice, entrails, peony, irises, isinglass, sullen, grim, swivel, fray, bilge, thwarts, oarlock, gunnels. 2. What is the subject of the poem and who is the speaker? 3. Find all of the similes (a comparison of two things using the words “like” or “as”) in the poem. Which of them, in your opinion, is the strongest and why? 4. Explain the following image: “Like medals with their ribbons/ frayed and wavering,/ a five-haired beard of wisdom/ trailing from his aching jaw.” What does she mean by “a five-haired beard of wisdom?” Why do you think Bishop chose to use the word “medals?” 5. Track Bishop’s use of color in the poem. Find the instances where she mentions specific colors. Why do you think that Bishop writes, “until everything/ was rainbow, rainbow, rainbow!” towards the end of the poem? 6. Bishop repeats words and phrases throughout the poem. Choose and instance where she uses repetition and explain how it contributes to the poem. 7. Explain the tone (the speaker’s attitude about the subject matter) of the poem. Use evidence from the poem to support your answer 8. What, in your thinking, is the strongest aspect of this poem? Do you like the poem? Why or why not? 9. Fill in the outline of a fish with 15 details from the poem. Please label each of the details. Feel free to add to the area around the fish.
In: Psychology
1 Frito-Lay’s Quality-Controlled Potato ChipsFrito-Lay’s Quality-Controlled Potato Chips Frito-Lay, the multi-billion-dollar snack food giant, produces billions of pounds of product every year at its dozens of U.S. and Canadian plants. From the farming of potatoes—in Florida, North Carolina, and Michigan—to factory and to retail stores, the ingredients and final product of Lay’s chips, for example, are inspected at least 11 times: in the field, before unloading at the plant, after washing and peeling, at the sizing station, at the fryer, after seasoning, when bagged (for weight), at carton filling, in the warehouse, and as they are placed on the store shelf by Frito- Lay personnel. Similar inspections take place for its other famous products, including Cheetos, Fritos, Ruffles, and Tostitos. In addition to these employee inspections, the firm uses proprietary vision systems to look for defective potato chips. Chips are pulled off the high-speed line and checked twice if the vision system senses them to be too brown. The company follows the very strict standards of the American Institute of Baking (AIB), standards that are much tougher than those of the U.S. Food and Drug Administration. Two unannounced AIB site visits per year keep Frito-Lay’s plants on their toes. Scores, consistently in the “excellent” range, are posted, and every employee knows exactly how the plant is doing. There are two key metrics in Frito-Lay’s continuous improvement quality program: (1) total customer complaints (measured on a complaint per million bag basis) and (2) hourly or daily statistical process control scores (for oil, moisture, seasoning, and salt content, for chip thickness, for fryer temperature, and for weight). In the Florida plant, Angela McCormack, who holds engineering and MBA degrees, oversees a 15-member quality assurance staff. They watch all aspects of quality, including training employees on the factory floor, monitoring automated processing equipment, and developing and updating statistical process control (SPC) charts. The upper and lower control limits for one checkpoint, salt content in Lay’s chips, are 2.22% and 1.98%, respectively. To see exactly how these limits are created using SPC, watch the video that accompanies this case.
Discussion Questions* 1.Angela is now going to evaluate a new salt process delivery system and wants to know if the upper and lower control limits at 3 standard deviations for the new system will meet the upper and lower control specifications noted earlier.
She picks a sample of four each hour for 5 hours. The data (in percent) from the initial trial samples are:
Sample 1: 1.99, 2.0, 2.08, 1.99
Sample 2: 1.98, 2.11, 2.15, 2.06
Sample 3: 2.01, 2.08, 2.14, 2.16
Sample 4: 2.18, 2.01, 2.23, 1.98
Sample 5: 2.20, 2.10. 2.20, 2.05
Analyze the data and draw the 푿푿� and R control charts in Microsoft Excel including the upper and lower control limits. (Hint: There is no population standard deviation available so you need to get A2, D3 and D4 for upper and lower limits)
2.Given these data and your analysis, what conclusion do you, as a Frito Lays quality control inspector, draw from this process? What report do you issue to your supervisor Angela? Explain your findings and decision based on the data analysis. (Hint: by monitoring the performance in these five hours, what will happen in the following hours as you observe from here?)
3.What are the advantages and disadvantages of Frito-Lay drivers stocking their customers’ shelves? Remark: Answer Question 1 in Excel File and Question 2 and 3 in Word file
In: Operations Management
Susan Harrington continued to drum her fingers on her desk. She had a real problem and wasn’t sure what to do next. She had a lot of confidence in Jack Reed, but she suspected she was about the last person in the office who did. Perhaps if she ran through the entire story again in her mind she would see the solution.
Susan had been distribution manager for Clarkston Industries for almost twenty years. An early brush with the law and a short stay in prison had made her realize the importance of honesty and hard work. Henry Clarkston had given her a chance despite her record, and Susan had made the most of it. She now was one of the most respected managers in the company. Few people knew her background.
Susan had hired Jack Reed fresh out of prison six months ago. Susan understood how Jack felt when Jack tried to explain his past and asked for another chance. Susan decided to give him that chance just as Henry Clarkston had given her one. Jack eagerly accepted a job on the loading docks and could soon load a truck as fast as anyone in the crew.
Things had gone well at first. Everyone seemed to like Jack, and he made several new friends. Susan had been vaguely disturbed about two months ago, however, when another dock worker reported his wallet missing. She confronted Jack about this and was reassured when Jack understood her concern and earnestly but calmly asserted his innocence. Susan was especially relieved when the wallet was found a few days later.
The events of last week, however, had caused serious trouble. First, a new personnel clerk had come across records about Jack’s past while updating employee files. Assuming that the information was common knowledge, the clerk had mentioned to several employees what a good thing it was to give ex-convicts like Jack a chance. The next day, someone in bookkeeping discovered some money missing from petty cash. Another worker claimed to have seen Jack in the area around the office strongbox, which was open during working hours, earlier that same day.
Most people assumed Jack was the thief. Even the worker whose wallet had been misplaced suggested that perhaps Jack had indeed stolen it but had returned it when questioned. Several employees had approached Susan and requested that Jack be fired. Meanwhile, when Susan had discussed the problem with Jack, Jack had been defensive and sullen and said little about the petty-cash situation other than to deny stealing the money.
To her dismay, Susan found that rethinking the story did little to solve his problem. Should she fire Jack? The evidence, of course, was purely circumstantial, yet everybody else seemed to see things quite clearly. Susan feared that if she did not fire Jack, she would lose everyone’s trust and that some people might even begin to question her own motives.
Case Questions
Q1: Explain the events in this case in terms of learning, perception, and attribution (18 marks, 3 marks for each point)?
Q2: If you were to decide about this case, would you fire Jack or give him another chance? Why?
Q3: Does personality play a role in this case?
Note : Answers should be in Details and in your own words and in Word Format
In: Operations Management
Lab #3 – Recursion on Strings Lab Objectives • Be able to write a recursive Java method for Java strings • Be able to make use of exploit natural conversion between strings and integers • Be able to write a driver to call the methods developed for testing Deliverables Submit the report in Word or PDF format with the results of every task listed below. They should show screen capture of your results. The problem String as a sequence of characters for developing recursive method Given a Java string object, we observe that it is a sequence (or ordered list) of characters. Our goal is to employ a very common technique in computer science—namely, dividing the list into its head (it’s first element) and its tail (the remaining list with the first element removed). We can then recurse on the tail, which happens to be smaller. We use this technique for reversing a string, or for checking whether it is a palindrome (reads the same if you read it from left or right). Task #1 Develop a left recursive method to reverse a string Develop a method with the prototype public static String reverseRecursiveLeft (String input) based on selecting the leftmost character as the head and the remaining part of the string as its tail. Here is the recursive design. 1. Base case: The problem is trivial when the string length is 0 or 1. 2. Decomposition: For strings of length > 1: • Extract its head (character) and the tail. You are expected to know the string methods needed to achieve this. • Make a recursive call to obtain the tail reversed. 3. Composition: Append (concatenate) the head to obtain the original string reversed. Task #2 Develop a right recursive method to reverse a string Develop a method with the prototype public static String reverseRecursiveRight (String input) based on selecting the rightmost character as the head and the remaining part of the string on its left as the tail. The only difference in the recursive design is that the reversed tail needs to be appended after the head character. Page 2 of 2 Task #3 Develop a middle recursive method to reverse a string Develop a method with the prototype public static String reverseRecursiveMiddle (String input) This time, instead of extracting one element (character) from left or right, extract two characters simultaneously from both left and right. design. This leads to a drop of 2 in size of the reduced problem. Be careful to take this into account when you design the base case. Should the base case be any different? Consider odd and even size strings Task #4 Develop a method to reverse an integer (as written in decimal form) Develop a method with the prototype public static int reverse (int input) using any of the previous three methods you developed for reversing a string. Note that, • For a negative integer, the result should also be negative with the digits reversed, i.e., your method should return -321 when presented with input -123. • You can make use of the toString() method available to any object. However, wrapper classes are needed for this, while operating on a primitive variable such as int. • The reconversion is easily achieved by the parse family of methods also available in the wrapper class. Task #5 Develop a middle recursive method to check whether a string is palindrome. Develop a method with the prototype public static boolean isPalindrome (String input) to check if a string is a palindrome. Determine which of the three types of recursion (left, right, or middle) maps directly to this problem. Also, overload the isPalindrome() for integer inputs as public static boolean isPalindrome (int input) using the same technique of integer-string inter-conversion. The same rule of reversing applies to negative numbers, i.e., only digits are considered for deciding whether the number is a palindrome. Write a driver to test your program and include screen captures in your report.
In: Computer Science
Option #1: Exotic Foods, Inc., Capital Budgeting Case
Exotic Food Inc., a food processing company located in Herndon, VA, is considering adding a new division to produce fresh ginger juice. Following the ongoing TV buzz about significant health benefits derived from ginger consumption, the managers believe this drink will be a hit. However, the CEO questions the profitability of the venture given the high costs involved. To address his concerns, you have been asked to evaluate the project using three capital budgeting techniques (i.e., NPV, IRR and Payback) and present your findings in a report.
CASE OVERVIEW
The main equipment required is a commercial food processor which costs $200,000. The shipping and installation cost of the processor from China is $50,000. The processor will be depreciated under the MACRS system using the applicable depreciation rates are 33%, 45%, 15%, and 7% respectively. Production is estimated to last for three years, and the company will exit the market before intense competition sets in and erodes profits. The market value of the processor is expected to be $100,000 after three years. Net working capital of $2,000 is required at the start, which will be recovered at the end of the project. The juice will be packaged in 20 oz. containers that sell for $3.00 each. The company expects to sell 150,000 units per year; cost of goods sold is expected to total 70% of dollar sales.
Weighted Average Cost of Capital (WACC):
Exotic Food’s common stock is currently listed at $75 per share; new preferred stock sells for $80 per share and pays a dividend of $5.00. Last year, the company paid dividends of $2.00 per share for common stock, which is expected to grow at a constant rate of 10%. The local bank is willing to finance the project at 10.5% annual interest. The company’s marginal tax rate is 35%, and the optimum target capital structure is:
| Common equity | 50% |
| Preferred | 20% |
| Debt | 30% |
Your main task is to compute and evaluate the cash flows using capital budgeting techniques, analyze the results, and present your recommendations whether the company should take on the project.
QUESTIONS
To help in the analysis, answer all the following questions. Present the analysis in one Excel file with the data, computations, formulas, and solutions. It is preferred that the Excel file be embedded inside the WORD document (question 8).
| Years | Free Cash Flows |
| 0 | ($252,000.00) |
| 1 | $118,625.00 |
| 2 | $127,125.00 |
| 3 | $181,000.00 |
(Show step by step answers )
In: Finance
Program 5A: Determine which student has the highest grade Write a Java program that determines which student has the highest grade. You will ask the user to enter the number of students. Then you will ask for each student and their grade. You will output the name and grade of the student with the highest grade. You will NOT use an array for this assignment.
Call your class Program5A, so your filename will be Program5A.java. It is essential for grading purposes that everyone have the same class name. 2. Create several lines of comments of identification and description at the top of the file (it doesn’t have to look exactly like this, in particular, if your editor wants to put * in front of every line, that’s fine):
Use comments liberally to document exactly what you are doing in the program. 4. Use descriptive variable names in camel-case with the first letter in lowercase. 5. Ask the user for the number of students and assign that to a variable of type int called numStudents using the nextInt method of Scanner.
At this point, try to compile and run your program. Don’t move on until this part is working. It would be good to enter a temporary print statement just to make sure this is working: System.out.printf("numStudents = %d\n", numStudents); It should be commented out before turning in the program (put // in front of it) or delete the line.
We need variables for highestName and highestScore of types String and int, respectively. Set highestName to the empty string and highestScore to 0.
Create a for loop. (Do NOT put a semi-colon after the for statement. Put an open curly brace instead, and go ahead and put the closing brace if your IDE doesn’t do it automatically, then put all the statement to be repeated BETWEEN the curly braces):
for (int i = 0; i < numStudents; i++) { a. As the first statement in the loop, add an extra line that reads to the end of the line: input.nextLine(); This is needed after a nextInt if you are going to then read a String. This basically burns the rest of the line (it ignores everything else to and including the end of the line which in this case will just be an end-of-line character '\n'), even though there is nothing there that you can see. You will need to do this any time that you have read in an int as you did for the number of students. (You could have done it right after you read the number of students, but then you would have to do it again in the loop right after reading the score. Doing it here takes care of both with one line of code.) b. Ask the user for name and score, which will be String and int types, respectively, which will require nextLine and nextInt. c. Compare score to highestScore. If score is greater than highestScore, then assign highestScore equal to score and highestName equal to name. There will not be an else. (If they are equal, we are NOT going to change the highest score so that in the event of a tie, the first one wins. However, in real life we would deal with ties in a better manner.) d. This is the end of the for loop, so put the closing brace if it’s not already there.
Outside of the for loop, print highestName and highestScore
ample Runs: (Enter this data exactly and make screen-prints to paste into a Word document that you will turn in to prove that your program works correctly. On the last one, just hit the Enter key without entering anything; it should sit there still waiting for integer input; if you then enter an integer, everything is fine and works like normal.):
Please enter number of students:4
Enter student name:Gus
Enter score:70
Enter student name:Suzy
Enter score:80
Enter student name:Allie
Enter score:100
Enter student name:Robert
Enter score:90
Highest score: Allie 100
Process finished with exit code 0
In: Computer Science
Python Programming
I have a skeleton code here for this project but do not know exactly where to start. My task is to implement a reliable File Transfer Protocol (FTP) service over UDP. I need help to write the reliable FTP client and server programs based on an Alternating Bit Protocol (ABP) that will communicate with a specially designated server. In socket-level programming as well...
# program description
# Library imports
from socket import *
import sys
import time
# Variable declarations
server = "harp.ece.vt.edu" # server
tcpPort = 21000 # TCP listening port
buffer = 4096 # defines the size of acceptable data for receipt
message ="debug" # controls condition of transfered data. debug: no delay or corruption
# normal: server introduces delays and errors into transmission
# Initialize variables
# sequence number value 1
# sequence number value 0
# Temporary variable for alternating sequence numbers
# control value transfer in progress
# initial setting is for ACK1 but changes during execution
# calculated by a char by char ordinal sum of the packet
# value is then converted to 4-digit ASCII value via
# sum mod 10000
PAYLOAD = ""
udpPort = 0 # variable to hold udpPort number
completeFile = [] # accumulation of complete file transfer
serverResponse = "" # server response variable
endFile = False # flag for end of transmission
badPacket = False #flag for bad checksum comparison
# Create socket variable
sTCP = socket(AF_INET, SOCK_STREAM) # TCP socket definition
sUDP = socket(AF_INET, SOCK_DGRAM) # UDP socket definition
# send ACK packet to server
Some further instructions include:
The four fields of the “RFP” protocol are:
● SEQUENCE: This is the sequence number of the packet, and can legally assume either of the two values: “0000” or “0001”.
● CHECKSUM: This is a 4-digit ASCII number that is the byte-by-byte sum, modulo-10000, of all data in the payload including the header SEQUENCE and header CONTROL.
● CONTROL: Used by the server to indicate Transfer in Progress “0000” or All Done “0001”. The client should set this field to “0000”. “0002” is reserved for future use.
● DATA: Used by the server to send part of the data file it is transferring
We will establish a “channel” here, the server will respond with a unique UDP port for you to use for your file transfer: 1. Open a TCP connection to harp.ece.vt.edu over port 21000 2. Send the word “normal” to the server over this port. 3. The server will respond with a number formed in an ASCII string. This is the UDP port that you shall use in the file transfer session. 4. Close the TCP connection. Once you have been assigned a UDP port, you are ready to start the file transfer after you open the socket.
To initiate the file transfer, the client should send an ACK1 packet (sequence number = “0001”, control = “0000”, a computed checksum, and zero bytes of data). As stated above, the checksum is the character-by-character ordinal sum over the entire packet (excluding the checksum field). For the ACK1 packet, checksum = “0”+”0”+“0”+”1”+“0”+”0”+“0”+”0” = ASCII 48 + 48 + 48 + 49 +48 + 48 + 48 + 48 = 385. The 4-digit modulo-10000 ASCII decimal equivalent of this checksum is “0385.” 1 The server will then start sequentially sending the file data, starting with a packet with Sequence Number 0. Abide by the Alternating Bit Protocol to transfer the contents of the file. When the server has completed the file transfer, it will send a final packet with no data with the control field set to “0001.” You must ACK this packet. Then you can close your UDP session and save the output file.
Since the file will be larger than a single packet, the server will segment the file into chunks that will fit within packets. The client will need to reassemble these and put them in a file called reliable.txt.
In: Computer Science