IT4X เทคนิคคอมพิวเตอร์ โน๊ตบุค ข่าว IT
ข่าวสาร / ความรู้ => คนเขียนโปรแกรม => ข้อความที่เริ่มโดย: pakiniy99 ที่ กันยายน 04, 2011, 21:31:38
-
มีเรื่องรบกวนหน่อยนะครับ :P
อยากให้รบกวนเขียน โค้ด ให้หน่อยอะครับ
["โจทย์ หาค่าคอมมิชชั่น จากรายได้ของเดือน ของพนักงาน past-time และ full-time
โดย past-time จะให้ค่าคอมมิชชั่น 15 %
ส่วน full-time จะแบ่งตามตำแหน่งงานดังนี้
ผู้จัดการ ให้ค่าคอมมิชชั่น 10%
พนักงานประจำ ให้ค่าคอมมิชชั่น 20%
พนักงานหน้าร้าน ให้ค่าคอมมิชชั่น 30% "]
-ก็คิดว่าโจทย์หน้าจะให้หา 1.เงินเดือน 2.ค่าคอมมิชชั่นตามตำแหน่งงาน
-แล้วอาจารย์บอกว่า จะมีให้ใส่ชื่อ ของพนักงานด้วย
ยังไงก็รบกวนด้วยนะครับ :-*
-
ต้องทำเป็น pascal เหรอครับ แนะนำเป็นภาษาอื่นจะดีกว่านะครับ
-
ครับต้องทำเป็น pascal แต่ทำได้ละครับ
program com;
uses wincrt;
var salary:longint;
commission,total:real;
job:integer;
begin
gotoxy (25,1);writeln('==============================');
gotoxy (30,2);writeln('*** Commission ***');
gotoxy (25,3);writeln('==============================');
gotoxy (25,4);writeln('job 1 = Employees Past-Time');
gotoxy (25,5);writeln('job 2 = Employees Full-Time distribute');
gotoxy (31,6);writeln('2 = Manager 3 = Employees 4 = Infront shop');
gotoxy (20,8);write('Enter Salary : ');
readln(salary);
gotoxy (20,9);write('Enter Job : ');
readln(job);
if job=1 then
begin
commission:=salary*15/100;
gotoxy (20,10);writeln('Your Commission 15 % = ',commission:1:2);
total:=salary+commission;
gotoxy (20,11);writeln('Your Total Salary = ',total:1:2);
end
else if job=2 then
begin
commission:=salary*10/100;
gotoxy (20,10);writeln('Your Commission 10 % = ',commission:1:2);
total:=salary+commission;
gotoxy (20,11);writeln('Your total Salary = ',total:1:2);
end
else if job=3 then
begin
commission:=salary*20/100;
gotoxy (20,10);writeln('Your Commission 20 % = ',commission:1:2);
total:=salary+commission;
gotoxy (20,11);writeln('Your total Salary = ',total:1:2);
end
else if job=4 then
begin
commission:=salary*30/100;
gotoxy (20,10);writeln('Your Commission 30 % = ',commission:1:2);
total:=salary+commission;
gotoxy (20,11);writeln('Your total Salary = ',total:1:2);
end
else
begin
writeln;
gotoxy (20,13);writeln('Error , Only Enter 1,2,3,4 ':34);
end;
end.
แล้วผมอยากได้คำสั่งที่ถามว่าจะออกจะโปรแกรมไหม ถ้าไม่ก็กลับมาทำใหม่ อะไรประมาณนี้ เหมือนกับสูตรที่คุณ Moshi เคยโพสไว้ในกระทู้ที่ปักหมุด
program it4x;
uses crt;
var ans:char;
begin
clrscr;
repeat
Write('Do you want to Exit (Y/N) = '); readln(ans);
ans:=upcase(ans);
until ans ='Y';
end.
นี่อะครับ ผมใส่สูตรเข้าไปมันก็ error จึงอยากจะรบกวนอีกนิดนึงอะครับ