دانلود رایگان سورس کد ماشین حساب به زبان جاوا
Calculator in JAVAتوضیحات مختصر محصول
ساخت برنامه ماشین حساب یکی از سوالات همیشگی هنرجویان رشته کامپیوتر می باشد. در این مطلب سورس کد ماشین حساب به زبان جاوا را برای شما عزیزان آماده کرده ایم.
درباره سورس کد:رمز عبور فایل فشرده www.copro.ir می باشد.
بخشی از سورس کد برنامه :
// if the value is a number if ((s.charAt(0) >= '0' && s.charAt(0) <= '9') || s.charAt(0) == '.') { // if operand is present then add to second no if (!s1.equals("")) s2 = s2 + s; else s0 = s0 + s; // set the value of text l.setText(s0 + s1 + s2); } else if (s.charAt(0) == 'C') { // clear the one letter s0 = s1 = s2 = ""; // set the value of text l.setText(s0 + s1 + s2); } else if (s.charAt(0) == '=') { double te; // store the value in 1st if (s1.equals("+")) te = (Double.parseDouble(s0) + Double.parseDouble(s2)); else if (s1.equals("-")) te = (Double.parseDouble(s0) - Double.parseDouble(s2)); else if (s1.equals("/")) te = (Double.parseDouble(s0) / Double.parseDouble(s2)); else te = (Double.parseDouble(s0) * Double.parseDouble(s2)); // set the value of text l.setText(s0 + s1 + s2 + "=" + te); // convert it to string s0 = Double.toString(te); s1 = s2 = ""; } else { // if there was no operand if (s1.equals("") || s2.equals("")) s1 = s; // else evaluate else { double te; // store the value in 1st if (s1.equals("+")) te = (Double.parseDouble(s0) + Double.parseDouble(s2)); else if (s1.equals("-")) te = (Double.parseDouble(s0) - Double.parseDouble(s2)); else if (s1.equals("/")) te = (Double.parseDouble(s0) / Double.parseDouble(s2)); else te = (Double.parseDouble(s0) * Double.parseDouble(s2)); // convert it to string s0 = Double.toString(te); // place the operator s1 = s; // make the operand blank s2 = ""; } // set the value of text l.setText(s0 + s1 + s2); }
نمایش بیشتر
دیدگاه های کاربران
دیدگاهتان را با ما درمیان بگذارید
تعداد دیدگاه : 1
امتیاز کلی : 5.0
توصیه خرید : 0 نفر
قیمت محصول
رایگان
قوانین استفاده
لینک های دانلود محصولات رایگان پس از تکمیل فرم مربوطه قابل دسترسی هستند و برای محصولات غیر رایگان، بلافاصله پس از پرداخت هزینه محصول در اختیار شما قرار می گیرد.
- دسترسی به فایل محصول به صورت مادامالعمر
- دانلود مستقیم فایل
- مشاوره رایگان قبل و بعد از خرید محصول
- گارانتی بازگشت وجه در صورت خرابی فایل
Misag
در تاریخ
عالیه