Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: ช่วย Assignment ผมทีครับ T^T

  1. #11
    Administrator asylu3's Avatar
    Join Date
    Jun 2000
    Location
    Thailand
    Posts
    3,557


    ผมขอกล่่าวขอบคุณแทน Black Phoenix ให้กับผู้ช่วยเหลือทุกๆท่านนะครับ (โดยเฉพาะ Edkung ที่ช่วยเหลือเยอะเป็นพิเศษ )
    และอยากให้ผู้รับการช่วยเหลือไป จับจุดให้ได้ว่า

    1. เหตุใดตัวเองจึงหลุดหรือผิดพลาดไปใน จุดนั้นๆ
    2. ผู้ช่วยเหลือทำอย่างไรในการแก้ปัญหาเหล่านั้นได้

    ซึ่งหากทำได้เช่นนี้แล้วรับรองว่า สามารถช่วยเหลือตัวเองในโอกาสหน้าแน่นอนครับ เพราะ Assignment หาก
    สามารถได้ "แนวทาง" แก้ปัญหาไปแทนที่จะได้ Solution ไปจะได้ประโยชน์มากกว่า
    เป็นกำลังใจให้ครับ

  2. #12
    Senior Member
    Join Date
    Oct 2006
    Location
    thailand
    Posts
    182


    ผมใช้ Visual Studio 2008 อ่ะครับ (ซึ่งผมก็ไม่แน่ใจว่ามันเป็นอันไหนเหมือนกัน ^^")[/b]
    อันนี้เป็น vb.net แล้วครับ - -'


    ความสุขอย่างหนึงของการเขียนโปรแกรมคือ การแก้บักได้สำเร็จ
    และโปรแกรมที่เราเขียนทำงานได้ มีมีคนใช้งาน :-)

    ผมลองทำ Assign1 เป็น VB.Net ให้ดูก็แล้วกัน --- ไม่รู้สายไปหรือป่าว (C++ Ed ทำไปแล้ว)
    และอ่านข้อมูลเพิ่มเติมได้ที่นี Object Oriented VB.net และที่นี่ ONDotnet
    จริงๆ ยังมีอีกเพียบ

    NameInStars.vb
    [code]
    Public Class NameInStars

  3. #13
    Senior Member
    Join Date
    Oct 2007
    Location
    Udon Thani
    Posts
    148


    ทีนี้เหลือแต่ภาษา Perl แล้ว ซึ่งผมยังไม่เข้าใจว่ามันจะจับเป็น Object ได้ยังไง - -a

    สงสัยงานนี้ต้องพึ่งเซียน Perl ด้วยล่ะมั้งเนี่ย (หนักใจความสามารถของตัวเองจริงๆ T^T)

    Edit : เลื่อนเส้นตายไปเป็นวันเสาร์นี้ครับ (รอดไป ^^")

    Edit 2: ขอขอบคุณทุกท่านที่ช่วยแก้ปัญหา Assignment ให้ผมนะครับ (ได้ความรู้ขึ้นอีกโขเลยงานนี้ ^^v)
    PS. Link ใดที่ผมโพสท์แล้วเสีย,โหลดไม่ได้ PM หาผมได้นะครับ</span>

  4. #14
    Senior Member
    Join Date
    Oct 2006
    Location
    thailand
    Posts
    182


    ทีนี้เหลือแต่ภาษา Perl แล้ว ซึ่งผมยังไม่เข้าใจว่ามันจะจับเป็น Object ได้ยังไง - -a[/b]
    ผมไม่มีเวลาที่จะทำตัวอย่าง Assignment ให้ ลองดูตัวอย่างที่นี่ครับน่าจะช่วยท่านได้ ที่เหลือท่านต้องออกแรงเอง

    Perl Object Oriented Programming

    Hope this help

  5. #15
    Senior Member
    Join Date
    Oct 2007
    Location
    Udon Thani
    Posts
    148


    ตอนนี้ติดปัญหาอยู่ที่ Assignment 3 ครับ แก้ยังไงก็ไม่ได้ซักที เริ่มงงๆ+ ง่วง

    Code ที่ผมทำมีดังนี้ครับ

    Employee.h
    [src]#include <cstddef>
    #include <cassert>
    #include <cstring>
    #include <cstdlib>

    #define restrict
    static const double MAX_NO_OVERTIME = 40; //hours in work week
    static const double OVERTIME_RATE = 1.5; //hours in work week
    static const double MAX_NO_DUES = 100; //max earnings before dues
    static const double DUES = 25; //dues amount
    class Employee {
    //class constants
    public:

    char *empID;
    double hours;
    double rate;
    //method with decision steps
    //postcondition - returns net pay
    double computeGross(){
    if (hours <= MAX_NO_OVERTIME){
    return hours * rate;
    }
    else {
    double regularPay = MAX_NO_OVERTIME * rate;
    double overtimePay = (hours - MAX_NO_OVERTIME)*
    OVERTIME_RATE * rate;
    return regularPay + overtimePay;
    }
    }
    //method with decision steps
    //postcondition - returns net pay
    double computeNet(double gross){
    if (gross<=MAX_NO_DUES)
    return gross;
    else
    return gross - DUES; //deduct dues amount
    }
    //Other methods
    Employee(){ }

    Employee(char *id,double ho,double ra){
    empID = id;
    hours = ho;
    rate = ra;
    }

    void setEmpID(char *id){
    empID = id;
    }

    char *getEmpID(){
    return empID;
    }

    char *const Con4Strs(char const *const restrict a,
    char const *const restrict b,
    char const *const restrict c,
    char const *const restrict d,
    char const *const restrict e,
    char const *const restrict f,
    char const *const restrict g) {

    assert(a); assert(; assert
    PS. Link ใดที่ผมโพสท์แล้วเสีย,โหลดไม่ได้ PM หาผมได้นะครับ</span>

  6. #16


    d:\bkpx\oop_cpp3\employee.h(95) : error C2664: &#39;Employee::Con4Strs&#39; : cannot convert parameter 4 from &#39;double&#39; to &#39;const char *const &#39;[/b]
    parameter ที่ 4 ผิดครับ ต้องเป็น pointer of char ไม่ใช่ double -> แปลงข้อมูลของ double ให้อยู่ในรูปข้อความก่อนค่อย pass ลงไป

    d:\bkpx\oop_cpp3\companypayroll.h(22) : error C2143: syntax error : missing &#39&#39; before &#39;;&#39;
    d:\bkpx\oop_cpp3\companypayroll.h(22) : error C2664: &#39;Employee::Employee(const Employee &)&#39; : cannot convert parameter 1 from &#39;std::basic_ostream<_Elem,_Traits>&#39; to &#39;const Employee &&#39;
    with
    [
    _Elem=char,
    _Traits=std::char_traits
    ]
    Reason: cannot convert from &#39;std::basic_ostream<_Elem,_Traits>&#39; to &#39;const Employee&#39;
    with
    [
    _Elem=char,
    _Traits=std::char_traits
    ]
    No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called[/b]
    ผิดเยอะครับ เอาแบบคร่าวๆ ลองเปลี่ยนเป็น

    Code:
    char *empID, *hours, *rate;
    cout << "Enter Employee id : "; cin >> empID;
    cout << "Enter hours worked : "; cin >> hours;
    cout << "How many employees? : "; cin >> rate;
    Employee programmer = new Employee (empID, hours, rate);
    แต่ว่า hours, rate ต้องแปลงเป็น double ก่อนนะครับ ถึงจะใช้ได้เพราะ constructer ของท่านมันเป็น Employee(char*, double, double)

    ส่วนข้างล่างกว่านี้ยังไม่ต้องไปดูครับ แก้ตรงนี้ให้หมดก่อน บางที พอแก้แล้ว จุดอื่นอาจจะหายตามไปด้วย

  7. #17
    Senior Member
    Join Date
    Oct 2007
    Location
    Udon Thani
    Posts
    148


    ขอถามอะไรโง่ๆนิดนึงนะครับ

    แปลงข้อมูลยังไงอ่า

    ลองใช้ทั้ง _gcvt(hours) กะ _gcvt(rate) แล้วมันก็ไม่ได้อ่ะครับ (วางไว้ก่อนถึงประโยค Employee programmer = new Employee (empID, hours, rate); อ่ะครับ)

    รบกวนด้วยนะครับ ขอบคุณล่วงหน้าครับผม
    PS. Link ใดที่ผมโพสท์แล้วเสีย,โหลดไม่ได้ PM หาผมได้นะครับ</span>

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 0
    Last Post: 22-11-2008, 05:04 PM
  2. Replies: 0
    Last Post: 17-09-2008, 04:03 PM
  3. NEW Assignment CSC105
    By massiah in forum Java
    Replies: 4
    Last Post: 04-11-2004, 11:37 PM
  4. CSC105 Assignment
    By massiah in forum Java
    Replies: 12
    Last Post: 03-11-2004, 09:54 AM
  5. assignment aj udom
    By armano in forum Announcement
    Replies: 4
    Last Post: 02-03-2003, 06:03 PM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •