Sponsored Content
Full Discussion: Help with this exercise
Homework and Emergencies Homework & Coursework Questions Help with this exercise Post 302389269 by bunkercrazy on Saturday 23rd of January 2010 07:05:38 PM
Old 01-23-2010
Bug Help with this exercise

you are to write a program which will read in a tax rate (as a percentage) and the prices of 5 items. the program is to calculate the total price, before tax, of the items and then the tax payable on those items, and then the total amount due. the tax payable is computed by appliying the tax rate percentage to the total price. all value are to be printed as output.

use the following steps to solve this problem:

1.define the problem using a defining diagram
2.create a solution algorithm using pseudocode
3.desk check your solution algorithm using two test cases
4.code the solution using the korn shell language
5.key the code into unix system under your home directory. include comments
6.give the program execute permission with the chmod command

Last edited by Scott; 01-23-2010 at 10:58 PM.. Reason: Removed links
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[question] trouble with an 'exercise'

Hello guys.. well, im kinda newbie with unix because i started to learn it like 2 weeks ago. then i started to make some exercises, but i got stucked on this one : so, i need to know how many different 'names' has the 5th field and how many times each name appears. i was trying with a... (6 Replies)
Discussion started by: EnioMarques
6 Replies

2. UNIX for Dummies Questions & Answers

[question] hard exercise, help needed

Hello guys. Well, on this exercise i need the average "chargeAmount" per hour (for each hour). with this code : cat getusagesummarywrongmatch | grep -iv MOU2GRTObject | cut -d'|' -f4,14 | grep -i chargeamount | cut -d' ' -f2 http://img227.imageshack.us/img227/5889/65969235do0.jpg i got... (2 Replies)
Discussion started by: EnioMarques
2 Replies

3. Shell Programming and Scripting

Trouble with part of an exercise

Hi, 'm trying to do an exercicise, and one part is: ls -l $1 | awk ' BEGIN { max = $5; } { if ($5 > max){ max = $5; } } END { print "Tamanio mayor fichero = " max; }' # Imprimimos ahora el menor tamaņo de fichero ls -l $1 | awk '... (4 Replies)
Discussion started by: Phass
4 Replies

4. Shell Programming and Scripting

A very tough exercise

hello everyone!:) I have an exercise which I think is difficult for beginner like me. Here is the exercise Create a shell script, which takes a directory as command line argument. Script displays ten first lines from every text file in that directory. After displaying the lines from the... (1 Reply)
Discussion started by: googlevn
1 Replies

5. UNIX for Dummies Questions & Answers

UNIX Exercise

Hi, I am learning unix. I want to practice few small excercises. Please suggest me some goor URL to practice. Thanks in advance. (1 Reply)
Discussion started by: stew
1 Replies

6. Homework & Coursework Questions

Grades exercise

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a shell script program that will input a name and a mark between 0 and 100. The program then displays the... (9 Replies)
Discussion started by: UniverseCloud
9 Replies
bc(1)							      General Commands Manual							     bc(1)

Name
       bc - interactive arithmetic language processor

Syntax
       bc [-c] [-l] [file...]

Description
       The command provides an interactive processor for a language which resembles C but provides unlimited precision arithmetic.  It takes input
       from any files given, then reads the standard input.  The -l argument stands for the name of an arbitrary precision math library.  The syn-
       tax for programs is as follows: L means letter a-z, E means expression, S means statement.

       Comments
	     are enclosed in /* and */.

       Names
	     simple variables: L
	     array elements: L [ E ]
	     The words `ibase', `obase', and `scale'

       Other operands
	     arbitrarily long numbers with optional sign and decimal point.
	     ( E )
	     sqrt ( E )
	     length ( E )   number of significant decimal digits
	     scale ( E )    number of digits right of decimal point
	     L ( E , ... , E )

       Operators
	     +	-  *  /  %  ^ (% is remainder; ^ is power)
	     ++   --	     (prefix and postfix; apply to names)
	     ==  <=  >=  !=  <	>
	     =	+=  -=	*=  /=	%=  ^=

       Statements
	     E
	     { S ; ... ; S }
	     if ( E ) S
	     while ( E ) S
	     for ( E ; E ; E ) S
	     null statement
	     break
	     quit

       Function definitions
	     define L ( L ,..., L ) {
		  auto L, ... , L
		  S; ... S
		  return ( E )
	     }

       Functions in -l math library
	     s(x) sine
	     c(x) cosine
	     e(x) exponential
	     l(x) log
	     a(x) arctangent
	     j(n,x)    Bessel function

       All function arguments are passed by value.

       The  value  of  a statement that is an expression is printed unless the main operator is an assignment.	Either semicolons or new lines may
       separate statements.  Assignment to scale influences the number of digits to be retained on arithmetic operations in the manner of  Assign-
       ments to ibase or obase set the input and output number radix respectively.

       The  same  letter  may  be  used  as  an array, a function, and a simple variable simultaneously.  All variables are global to the program.
       `Auto' variables are pushed down during function calls.	When using arrays as function arguments or defining them  as  automatic  variables
       empty square brackets must follow the array name.

       The following example defines a function to compute an approximate value of the exponential function:
       scale = 20
       define e(x){
	    auto a, b, c, i, s
	    a = 1
	    b = 1
	    s = 1
	    for(i=1; 1==1; i++){
		 a = a*x
		 b = b*i
		 c = a/b
		 if(c == 0) return(s)
		 s = s+c
	    }
       }

       The following command line then prints approximate values of the exponential function of the first ten integers:
	    for(i=1; i<=10; i++) e(i)

       The  command  is  actually a preprocessor for which it invokes automatically, unless the -c (compile only) option is present.  In this case
       the input is sent to the standard output instead.

Options
       -c		   Compiles input only.

       -l		   Names arbitrary precision math library.

Restrictions
       The for statement must have all three E's.

       Quit is interpreted when read, not when executed.

       Variables must be a single lower case letter.  Upper case letters are used only as digits for bases greater than 10.

Files
       mathematical library

See Also
       dc(1)
       ``BC - An arbitrary precision desk-calculator language'' ULTRIX Supplementary Documents Vol. 1: General User

																	     bc(1)
All times are GMT -4. The time now is 07:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy