الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Why Is The Error In This Program ?

بدأه Yellow Bee في 7 مايو 2008 · 3 رد · 671 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

*** The error appears in : public void PrintValues() << It says : class or interface is expected ??

what does that means ? How can I fix this error ???

This is my program :

class Vehicle

{

private int VehicleNo;

private char ModelYear;

private char ModelName;

private int BasicPrice;

private int Tax;

public void GetValues( int V,char M,char Mo,int B,int T)

{

VehicleNo = V;

ModelYear = M;

ModelName = Mo;

BasicPrice = B;

Tax = T;

}

public int CalculatePrice()

{

Netprice=BasicPrice + Tax;

}

}

public void PrintValues()

{

System.out.println("The Vehicle number is "+VehicleNo);

System.out.println("The Model year is "+ ModelYear);

System.out.println("The Model name is "+ ModelName);

System.out.println("The Basic price is "+ BasicPrice);

System.out.println("The Tax is "+ Tax);

System.out.println("The Netprice is "+ Netprice);

}

class Question1

{

public static void main(String args[])

{

Vehicle e=new Vehicle();

Vehicle e1=new Vehicle();

e.getValues(34561,"2006","Toyota",15.000,120);

e1.getValues(92634,"2007","BMW",75.000,90);

e.CalculatePrice();

e1.CalculatePrice();

e.PrintValues();

e1.PrintValues();

}

}

تم تعديل هذه المشاركة بواسطة Yellow Bee في 7 مايو 2008 في 18:22

#2

Thank you but I still have error in :

e.getValues(34561,2006,"Toyota",150000,120,110);

e1.getValues(92634,2007,"BMW",75000,90,170);

It says : getValues int,int,char,int,int,int in Vehicle cannot be applied to int,java.lang.string,int,int,int

any help please ?

#3

عفوا اخي ..

انا ماحطيت السؤال الا بعد محاولات !!

ولا تستغرب .. لاني عموما اول مره اتعامل مع الجافا

فاخطاء مثل هذا واكثر ممكن تقع

وبعدين انا اصلا مو فاهم شو الخطأ

كيف يعني البيانات مو متطابقه

وانا استخدمت الميثود فوق و بعدها عملت دكلريشن تحت GetValues

وفي النهايه انا انادي البيانات ( عطيتها قيم محدده ) بنفس الميثود اللي استخدمته getValues

فاذا ممكن تصحح الخطا او غيرك يساعدني ...... ولكم الشكر !

تم تعديل هذه المشاركة بواسطة Yellow Bee في 8 مايو 2008 في 18:01

#4

يا أخي الجافا حساسة لحالة الأحرف case sensitive

بمعنى أنك عندما تسمي الدالة بحروف كبيرة يجب أن تناديها بحروف كبيرة

وإلى فإنه سيعتبرها دالة أخرى

بمعنى أن GetValues

تختلف عن getValues

ثانياً أنت عرفت الدالة بشكل وأعطيتها مدخلات بشكل مختلف

e1.getValues(92634,2007,"BMW",75000,90,170);

public void GetValues( int V,char M,char Mo,int B,int T

بصراحة أن مع Leavetrace في كلامه

بمناسبة أنك تتعامل مع الجافا أول مرة

فكلنا مررنا بنفس التجربة

وهذا ليس بعيب

كما أنه ليس بحجة

أهلاً بك معنا في الفريق

تحياتي

حزمة المحرك الإصدارة 0.8

أي أحد يجد أني ظلمته فليراسلني

وبإذن الله لو كان له حق سيأخذه

728x90.png

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…