منتدى طلاب وطالبات الجامعة السعودية الإلكترونية

منتدى طلاب وطالبات الجامعة السعودية الإلكترونية (https://www.alseu.com/)
-   CS 140 (https://www.alseu.com/f70/)
-   -   assignment 1 اللي يقدر يعلمنا طريقة الحل (https://www.alseu.com/t30949/)

MustafaMeel 03-10-2020 11:37 PM

assignment 1 اللي يقدر يعلمنا طريقة الحل
 
1 مرفق
السلام عليكم اللي يقدر يساعدنا في حل الاسايمنت لا يبخل
شكرا لكم

Q1-Your team was asked to program a self-driving car that reaches its destination with minimum travel time.
Write an algorithm for this car to choose from two possible road trips. You will calculate the travel time of each trip based on the car current speed and the distance to the target destination. Assume that both distances and car speed are given.


Q2-
Write a complete Java program that do the following:
1. Declare String object and a variable to store your name and ID.
2. DisplayYour Name and Student ID.
3. Display Course Name, Code and CRN
4. Replace your first name with your mother/father name.
5. Display it in an uppercase letter.
Note:Your program output should look as shown below.
My Name: Ameera Asiri
My student ID: 123456789
My Course Name: Computer Programming
My Course Code: CS140
My Course CRN: 12345
AIYSHA ASIRI




Q3-Write a tester program to test the mobile class defined below.
Create the class named with your id (for example: Id12345678) with the main method.
a) Create two mobiles M1 and M2 using the first constructor.
b) Print the characteristics of M1 and M2.
c) Create one mobile M3 using the second constructor.
d) Change the id and brand of the mobile M3. Print the id of M3.
Your answer should include a screenshot of the output. Otherwise, you will be marked zero for this question.
public class Mobile **
private int id;
private String brand;

public Mobile() **
id = 0;
brand = "";
**

public Mobile(int n, String name) **
id = n;
brand = name;
**

public void setBrand(String w) **
brand = w;
**

public void setId(int w) **
id = w;
**

Public int getId() **
return id;
**

public String getBrand() **
return brand;
**

**


Answer:




Q4-
Write a method named raiseSalary that accepts two integers as an argument and return its sum multiplied by 15%. Write a tester program to test the method. The class name should be your ID (for example: Id12345678).
Your answer should include a screenshot of the output. Otherwise, you will be marked zero for this question.


الساعة الآن 05:21 PM

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.1 TranZ By Almuhajir

Security team