En cours

perl script(very urgent 1 hr left for 3 small perl scripts)

CH10HW1

The factorial of a nonnegative integer n is written as n! and is defined as follows:

n! = n * (n-1) * (n-2) * ... * 1 ( for values of n greater than or equal to 1

and

n! = 1 (for n = 0)

For example, 5! = 5 * 4 * 3 * 2 *1 (which is 120).

Write a program that reads a nonnegative integer and uses a foreach construct to compute and print its factorial.

----------------------------------------------------------------

CH12hw1

Review: Full, Anonymous: No

Write a Perl script that will use assign interger values to each of two variables.

The program should swap the values in the variables without using any additional variables to temporarily hold either of the values.

HINT: Use the bitwise exclusive or operator to complete this assignment

----------------------------------------------------------------------------------------

proj2

Write a program that will keep track of expense information in a file. The file is the [url removed, login to view] file that can be found in this folder

The user of the application should be allowed to:

* · Update the expense amount for an item

* · Get a report on a particular category

* · Get a total of all expenses

You should print a menu and prompt the user to enter a choice. If appropriate, based on the choice, it should ask for the category and the amount.

NOTE: since this is an expense file, you should be able to add new values to the existing category expense as found in the file

What's Next?

[url removed, login to view]

Write a program that will keep track of expense information in a file. The file is the [url removed, login to view] file that can be found in this folder

The user of the application should be allowed to:

•· Update the expense amount for an item

•· Get a report on a particular category

•· Get a total of all expenses

You should print a menu and prompt the user to enter a choice. If appropriate, based on the choice, it should ask for the category and the amount.

#!/usr/bin/perl -w

print "-------------------------------\n";

print "| Expense Worksheet |\n";

print "-------------------------------\n";

open expwk, "[url removed, login to view]";

while(my $exps = <expwk>)

{

@expspt = split(/:/, $exps);

print "\t@expspt[0]:";

print "@expspt[1]\n";

}

print "Press 'U' To Update Category,";

print "'R' for Report,";

print "'T' for Total,";

print "and Q to Quit:";

$opt = <STDIN>;

if($opt=~/^u/i){

&upcat();

print "\n";

}

elsif($opt=~/^r/i){

&report();}

elsif($opt=~/^t/i){

&total();}

else

{

print "\nyou have entered an invalid option\n";

}

sub upcat{

print "Please Select Category For Update:";

$updtcat = <STDIN>;

if($updtcat=~/food/i){

print "\nPlease Enter New Amount Below:\n";

$updtamt=<>;

return $updtamt;

}

#elsif($updtcat=~/books/i){

#print "\nPlease Enter New Amount Below:\n";

#$updtamt=<>;

#return $updtamt;

#}

elsif($updtcat=~/clothes/i){

print "\nPlease Enter New Amount Below:\n";

$updtamt=<>;

return $updtamt;

}

elsif($updtcat=~/^car/i){

print "\nPlease Enter New Amount Below:\n";

$updtamt=<>;

return $updtamt;

}

elsif($updtcat=~/gas/i){

print "\nPlease Enter New Amount Below:\n";

$updtamt=<>;

return $updtamt;

}

elsif($updtcat=~/movies/i){

print "\nPlease Enter New Amount Below:\n";

$updtamt=<>;

return $updtamt;

}

elsif($updtcat=~/music/i){

print "\nPlease Enter New Amount Below:\n";

$updtamt=<>;

return $updtamt;

}

else{

print "You Have Entered Invalid Selection";

}

}

sub report(){

}

sub total(){

}

Compétences : Perl

Voir plus : factorial nonnegative integer perl, w split, what should i ask for, s.w. gas, perl get, any clothes, $22 hr, perl program reads nonnegative integer uses foreach, factorial nonnegative integer written perl, r in operator, food category, car t com, write food review, report w, print hold, hr and, Food review , expense, construct, select category, application dropbox, expenses report, invalid script, write script file, perl script file

Concernant l'employeur :
( 359 commentaires ) Mutrah, Oman

N° du projet : #891908

Décerné à :

ChinaCoCo

i can do the work for you

30 $ USD en 1 jour
(3 Commentaires)
3.8