1) In this assignment you will play the role of Cheaty McCheaterpan...

  1. Home
  2. Homework Library
  3. Computer Science
  4. Linux
  5. 1) In this assignment you will play the role of Cheaty McCheaterpan...


1) In this assignment you will play the role of Cheaty McCheaterpants. Your instructor, BigBritches McMakesyouwork, has just assigned you your final project for the semester. After checking your grade (and spending more time doing math to figure out the minimum score you need to pass than you did studying the entire semester) you have come to the conclusion that with a score of 100% you are going to receive exactly 70% in the class, any less and you will fail (mostly because you think extra credit is for suckers). Unfortunately for you, Cheaty McCheaterpants, you don't even know how to start the actual assignment. Fortunately you know the finer points of success; cheating, lying and stealing. You also have me, your helpful narrator. The following three steps will lead us to an illegitimate C in this god forsaken course.

a. Step 1. We know that you need a perfect score on the final project, and we know from the way some of the less socially aware students brag that they are getting 100% on every assignment AND that they are already done with the assignment. Unfortunately, because you don't associate with people like that, you have no idea what their name is or, more importantly, their login information. We do, however, know three very important pieces of information.

i. McMakesyouwork is lazy about his security.
ii. He has a TA that you can bribe.
iii. The TA will provide you with all of the current account information.

After you slip $50 bucks in the right pocket, you have gained a copy of the gradebook and the student login information. (This is quite literally the easiest way to steal important information from an organization and one of the key points of account security when terminating employees).

Write a script that takes two arguments. The first argument should be the grades file location and the second argument should be the logins file location. Your script must determine the name of the student that has received 100 on all of the assignments and echo that name to stdout. Next your script must determine both the login name and password for that user and echo that information as well.


b. Step 2. Try logging into their gitlab account! Whats that? Smarty McBetterthanyou changed their default password??? That Jerk! Fortunately, Smarty wasn’t very smart when setting up their repositories and accidentally made them public: Go ahead and clone the repository to your local computer.

Unfortunately their repository is a mess. They have files everywhere with nonsense names and no file extensions! We do know something about the class fortunately. We know that all of the assignments are written in C!
Write a script that takes a single argument. The argument will be the root directory of the repository. The script will then copiy all of the C programs to the current directory (the directory the script is run from) and make sure you tack a “.c” onto the end of each of those files. Every time a file is copied, it should echo the final name of the file copied (including the “.c”). (There are four files you want). Use this on Smarty's repository to copy all of his C programs!

c. Step 3. Now that you have all of Smarty's C programs we have to figure out which one is the final project. We literally don't care enough to figure out what the final project is supposed to do, but we do know what the first three assignments did.

i. Assignment #1 Took in a single integer on the command line in degrees and printed out the cosine of the input to three decimal places.
ii. Assignment #2 Took in a single integer on the command line and printed out the square root of the input to four decimal places.
iii. Assignment #3 Took in a single integer on the command line and printed out that number divided by 10 to five decimal places.

Based on this information write a script that takes four command line argument compiles each of the c programs that matches one of those command line arguments, determines which assignment each one is and echos the file name and the assignment that it corresponds with. Use this script to determine which .c file goes with each assignment.
Yes! Now we can turn that file in and we are saved from another semester of McMakesyouwork's insufferable 'humor'. (You should really only turn in your three shell scripts).

2) You must ensure that your code can be run on a standard Debian based linux distribution using the shell tools of your choice. You may develop your solution on any machine you desire, as long as the final solution works on a standard linux distribution.

3) Your solution must have a complete comment. During runtime, each of your solutions to section 1 must output a correct title string as the first line printed.

Each problem should follow this format, with the second number incremented for each problem in part 1.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

echo "Assignment #2-3, <NAME>, <EMAIL>"
pi=`echo "x=4*a(1); if(x<1) print 0; x" | bc -l`
rad=`echo "x=$1*($pi/180); if(x<1) print 0; x" |bc -l`
csn=`echo "scale=3;x=c($rad); if(x<1) print 0; x" | bc -l`
sqrte=`echo "scale=4;x=sqrt($2); if(x<1) print 0; x" | bc -l`
tendiv=`echo "scale=5;x=(($3/10)); if(x<1) print 0; x" | bc -l`
td2=`echo "scale=5;x=($tendiv)^2; if(x<1) print 0; x" | bc -l`
for i in *.c
gcc "$i" -o "${i%.c}.out" -lm -Wno-implicit
declare -a assno
for i in *.c
var1=`echo "${i%.c}.out $1"`
if [ "$oupt" = "nan" ] || [ "$oupt" = "-nan" ];
tmp=`echo "($csn-$oupt)^2;" | bc -l`
       c=`echo "if ($tmp<=0.0001) 1 else 0" | bc -l`
if [ "$c" -eq 1 ];
             echo "$i : Assignment #1."

By purchasing this solution you'll be able to access the following files:

for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Linux Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats