01/04/06
We are discussion the program on page 45
Building the Payroll Program (First Version)
Where does the "C" derive from? What does it stand for?( This question was asked by Lena)
Its high level language, can also manage low level features
and binary coding.(1970)
C replaces PASCAL as a teaching language. (Page 11) Language called B, B came
from BCPL, BCPL came from CPL , CPL came from ALGO(Page:717 B
Language)
Where does the Java come from? Ans: Coffee bean, from an
Island in Indonesia.
Java was known as OAK
Unix Operating System: It's opponent of Microsoft Operating system.
Was copied from ACM Communication Jan 2006
Add PBE to Conventional Languages
I read guest editor Henry Lieberman's special section introduction, "Programming By Example," and the following article "Novice Programming Comes of Age" (Mar. 2000) by David Canfield Smith et al. with great interest. I agree there is a problem with current conventional programming languages, which contain arcane syntactic notations and form, leading to misconceptions. However, I question the feasibility of the proposed programming by example (PBE) "Creator," as widely acceptable for the programming curriculum or, for that matter, as a substitute for conventional languages.
In regard to learning programming using conventional languages, I went through an experience similar to the authors'. When I first started programming, I questioned the way programs were represented in a textual and linear form. Programs were divided into several groups of statements situated one after the other, thus giving the impression that every statement flows sequentially. However, in a program, when one group of statements is executed, another group may be skipped. Also, it is possible that one group of statements is executed more than once. The textual representation of programming did not help me realize the actual flow of the program and led to much confusion. A pictorial representation of the program could have eliminated this confusion.
The understanding of control flow was the most challenging part of programming for me. After 23 years of educating novice programmers, I have now found, and continue to find, students experiencing the same difficulty. Not much has been done in conventional programming languages, whether procedural or object-oriented, to tackle this problem.
While PBE is a great idea and Creator is a successful model, the question of how it will achieve its goal of being widely accepted remains. Is it the goal of Creator to take over the beginner's programming curriculum and replace the existing conventional languages?
In the past several years, I have not seen a drastic change with regard to programming languages. Any current changes in programming languages are built on the existing languages. For example, C++, Java, and others are all built on C, which itself is built on Algol and Fortran with the backing of a big enterprise or a major institution. It may be argued that even though the design intention of C was for system programming, it has received wide acceptance and has moved into the business and scientific communities. Why has this occurred? Is it a miracle, good luck, performance and production (Unix), or others reasons? The question we need to asked is, How can Creator achieve similar success and become widely accepted?
If Creator is not winning by revolution, then perhaps a transitional period could be a remedy. As indicated by the author, there is a conservative community in the programming field that simply won't accept such a drastic change. It is also important to note that this conservative community is not fading away, so a gradual or evolutionary change is indicated.
Within programming languages, we have seen poorly chosen notations that were adopted because they were the only option, due to the lack of technology, other restraints, or even personal taste. However, these notations continue to be carried on from language to language, as a bad gene continues from one generation to the next. In the past 50 years, there has been no reexamination of these languages. Based on this observation, it would be prudent to incorporate the good features of the current conventional languages into Creator as an option. This would ease the transition of traditional programming to the new PBE standard.
In addition, there should be a massive campaign advocating the benefits and broad feasibility of Creator as a general programming tool and not just as a simulation tool for children's games. For example, given the ability to solve a common programming problem, such as finding an average, a minimum, or sorting, in both PBE and a conventional language would give readers a better chance to compare both languages.
I disagree that nothing has been done to address the problem of novice programmers. In fact, there has been an ongoing effort to resolve the problem of languages written prior to PBE. Two such examples are Karel the Robot, 1981 (Karel++, object-oriented version, 1997) and my own VPCL (Visual Plan Construct Language), 1989. The empirical studies of novice programmers indicate that students who study these languages do substantially better in conventional languages. Therefore, I fully agree with the assertion that working with Creator results in better understanding of conventional languages. The only drawback is that students dislike the fact that they have to learn additional languages and then learn conventional languages.
Alireza Ebrahimi
Old Westbury, NY
On page 45:
2A) Computing the Gross Pay without Tax
msgbox ("GROSSPAY IS
"&grosspay)
2B) Net pay with Tax
msgbox ("GROSSPAY IS
"&grosspay)
msgbox ("NETPAY IS
"&netpay)
Netpay has TAXAMOUNT included. (Do not leave space)
Leave 10 spaces after the word "IS" for formatting reasons
In Payroll program we will be using name
Convention of naming is that to use all lowercase without using any special
characters.
employeeid
hoursworked
hourlyrate
the above variables are input variables, case study requires these will be the output.
problem specification
what goes in comes out. Always you need to test your input data.
Therefore,
msgbox("EMPLOYEE ID "&employeeid)
msgbox("HOURS WORKED "&hoursworked)
msgbox("HOURLY RATE "&hourlyrate)
msgbox("GROSS PAY "&grosspay)
msgbox("TAX AMOUNT "&taxamount)
msgbox("NET PAY "&netpay)
ORDER IS VERY IMPORTANT, therefore GROSS PAY has to be before NETPAY
tax amount has to be before net pay
What is Operation? Multiplication,
line 14 page 45,
grosspay=hoursworked*hourlyrate
syntax error if you put X instead of * (look at page 17; mysteries of programming)
Computation for 2B
grosspay=hoursworked*hourlyrate
taxmount=grosspay*taxrate
netpay=grosspay-taxamount
to input data into program we are going to use inputbox
what is syntax of inputbox
inputbox("ENTER THE EMPLOYEE ID")
This inputbox has to be assigned to a variable name
what is the variable name that above inputbox will be assigned?
employeeid=inputbox("EMPLOYEE ID")
Programming is not about math, its not about art, its not about science, its not about engineering, its not about sociology. Programming is all of the above. You need science to prove what you are doing and art to make it beautiful.
Now we are going to have hands on experience which is explained in the handout.
How would we write a program using VB .Net?

case study on page 51.
Make sure to be consistent in naming. What's wrong with these two words?
hoursworked and hourworked.
one has "S" other doesn't.
Variable name NO SPACE
Outside of the quotation variable can't have space between the words.

click on new project


when you see this , please smile.
double click on the form box.

The first stage of the program is to type but don't type fast.
There is a problem with this program. What is it?
we are building the solution. Click on build and hit build solution.



SYNTAX ERROR SAYS DECLARATION IS MISSING.
HOW DO YOU DECLARE A VARIABLE NAME.
START WITH A HISTORICAL WORD DIM, FOLLOWED BY NAME ITSELF, FOLLOW BY THE WORD AS, FOLLOWED BY THE TYPE OF DATA (integer,single,char,double,string, etc...)
dim employeeid as integer
integer is whole is number
single is fraction
double is fraction either is too small or too big, double room occupancy
char is one letter or one digit or one hit
string is more than one
here is the whole program
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim employeeid As Integer Dim hoursworked As Integer Dim hourlyrate As Single Dim taxrate As Single Dim taxamount As Integer Dim grosspay As Single Dim netpay As Single 'start of input data'
employeeid = InputBox("EMPLOYEE ID")
hoursworked = InputBox("HOURS WORKED")
hourlyrate = InputBox("HOURLY RATE")
taxrate = InputBox("TAX RATE")
'start of process or computation'grosspay = hoursworked * hourlyrate
taxamount = grosspay * taxrate
netpay = grosspay - taxamount
MsgBox("EMPLOYEE ID " & employeeid)
MsgBox("HOURS WORKED " & hoursworked)
MsgBox("HOURLY RATE " & hourlyrate)
'start of output'MsgBox("GROSS PAY " & grosspay)
MsgBox("TAX AMOUNT " & taxamount)
MsgBox("NET PAY " & netpay)
End Sub
End
Class
There is a logical error there, there is an extra spurious (extraneous line)
Final program for this payroll
Dim employeeid As Integer Dim hoursworked As Integer Dim hourlyrate As Single Dim taxrate As Single Dim taxamount As Integer Dim grosspay As Single Dim netpay As Single 'start of input data'
employeeid = InputBox("ENTER THE EMPLOYEE ID")
hoursworked = InputBox("HOURS WORKED")
hourlyrate = InputBox("HOURLY RATE")
taxrate = InputBox("TAX RATE")
'start of process or computation'grosspay = hoursworked * hourlyrate
taxamount = grosspay * taxrate
netpay = grosspay - taxamount
MsgBox("EMPLOYEE ID " & employeeid)
MsgBox("HOURS WORKED " & hoursworked)
MsgBox("HOURLY RATE " & hourlyrate)
'start of output'MsgBox("GROSS PAY " & grosspay)
MsgBox("TAX AMOUNT " & taxamount)
MsgBox("NET PAY " & netpay)









