InstagramTwitterSnapChat


 
وصف

العودة   منتديات سكاو > الكليات الجامعية > منتدى كلية الحاسبات وتقنية المعلومات > المنتدى العام لكلية الحاسبات وتقنية المعلومات
التسجيل مشاركات اليوم البحث
   
   


المنتدى العام لكلية الحاسبات وتقنية المعلومات قسم خاص بالمواد العامة و الطلاب غير المتخصصين بكلية الحاسبات وتقنية المعلومات

برمجة 202

المنتدى العام لكلية الحاسبات وتقنية المعلومات

إضافة رد
 
أدوات الموضوع إبحث في الموضوع انواع عرض الموضوع
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
  #1  
قديم 09-11-2012, 02:20 PM
الصورة الرمزية صبر بلاحدود

صبر بلاحدود صبر بلاحدود غير متواجد حالياً

صبر جميل والله المستعااان

 
تاريخ التسجيل: Jan 2010
التخصص: أحصــــــــاء
نوع الدراسة: إنتظام
المستوى: الثالث
الجنس: أنثى
المشاركات: 521
افتراضي رد: برمجة 202


مشكور ع التوووضيح شرح ممتاز...

ممكن حل هذا السوال مافهمته...


Problem 1:

Write a program that asks the user to enter a favorite color, a favorite food, a favorite animal, and the first name of a friend or relative. The program should then print the following two lines, with the user’s input replacing the items in italics: I had a dream that Name ate a Color Animal and said it tasted like Food!

For example, if the user entered blue for the color, hamburger for the food, dog for the animal, and Jake for the person’s name, the output would be
I had a dream that Jake ate a blue dog and said it tasted like hamburger!
Don’t forget to put the exclamation mark at the end.

Notes:

This project requires careful attention to spaces in output messages. In particular, a space must be explicitly printed between the variables color and animal.














Solution: as an example

Problem Analysis Chart:



Given Data
Required Results
name
color
animal
food
Print “I had a dream that Name ate a Color Animal and said it tasted like Food!"

Processing Required
Solution Alternatives
System.out.println("I had a dream that " + name + " ate a " + color + " " + animal); System.out.println("and said it tasted like " + food + "!");




Algorithm:

1. Read Name from user.
2. Read Color from user.
3. Read Animal from user.
4. Read Food from user.
5. Display message “I had a dream that Name ate a Color Animal and said it tasted like Food!"

Sample Code Solution:

From now on to the end of your four year program here at the University, every program you submit whether it is in lab or as homework should include the following:
• File name
• Full deion of the coded program
• Author: Name of student
• Student ID
• Student email address
• Date submitted










/

File name: SillySentence.java

This program does the following:
Prompts the user to enter a friend's or relative's name,
a favorite color, a favorite food, and a favorite animal.
Prints the following sentence with the user's input inserted:

I had a dream that NAME ate a COLOR ANIMAL and said
it tasted like FOOD!

Author: Lew Rakocy
email address: LRakocy@devrycols.edu
Date: 8/13/2000

*/
import java.util.*;

public class SillySentence
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);

System.out.println("Enter the name of someone you know:");
String name = keyboard.nextLine();

System.out.println("Enter your favorite color: ");
String color = keyboard.nextLine();

System.out.println("Enter your favorite food: ");
String food = keyboard.nextLine();

System.out.println("Enter your favorite animal: ");
String animal = keyboard.nextLine();

System.out.println("I had a dream that " + name
+ " ate a " + color + " " + animal);
System.out.println("and said it tasted like " + food + "!");

}
}

 


توقيع صبر بلاحدود  

 

رد مع اقتباس

 

إضافة رد


تعليمات المشاركة
لا تستطيع إضافة مواضيع جديدة
لا تستطيع الرد على المواضيع
لا تستطيع إرفاق ملفات
لا تستطيع تعديل مشاركاتك

BB code is متاحة
كود [IMG] متاحة
كود HTML معطلة

الانتقال السريع

 


الساعة الآن 12:06 AM


Powered by vBulletin® Version 3.8.9 Beta 3
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Ads Organizer 3.0.3 by Analytics - Distance Education

أن كل ما ينشر في المنتدى لا يمثل رأي الإدارة وانما يمثل رأي أصحابها

جميع الحقوق محفوظة لشبكة سكاو

2003-2025