Questions
Please Use your keyboard (Don't use handwriting) Thank you.. I need new and unique answers, please....

Please Use your keyboard (Don't use handwriting) Thank you..

I need new and unique answers, please. (Use your own words, don't copy and paste)

Q1:

Your team is 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 prints out the following information:

  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 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

Note : Include the screenshot of the program output as a part of your answer.

_____

Q3:

Write a tester program to test the given class definition.

Create the class named with your id with the main method.

  1. Create two mobiles M1 and M2 using the first constructor.
  2. Print the characteristics of M1 and M2.
  3. Create one mobile M3 using the second constructor.
  4. Change the id and brand of the mobile M3. Print the id of M3.

Your answer should be supported with the screenshot of the output, else zero marks will be awarded.

public class Mobile

{

int id;

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;

          }

}

___

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.

Your answer should be supported with a screenshot of the program with output.

In: Computer Science

Consider f,g:ℤ→ℤ given by: f(n) = 2n g(n) = n div 2 Which of the following...

Consider f,g:ℤ→ℤ given by:

  • f(n) = 2n
  • g(n) = n div 2

Which of the following statements are true? Select all that apply

(a)

f is an injection

(b)

g is an injection

(c)

f∘g is an injection

(d)

g∘f is an injection

(e)

f is a surjection

(f)

g is a surjection

(g)

f∘g is a surjection

(h)

g∘f is a surjection

In: Computer Science

1. Provide brief answers to the following questions: a) What is preprocessing in C programming language?...

1. Provide brief answers to the following questions:
a) What is preprocessing in C programming language? Cite 3 examples of preprocessor directives in C.
b) What is the main difference between Heap and Stack memory regions?
c) What is the difference between Stack and Queue?
d) What is the purpose of a compiler? Name the C compiler that you used for this course?
e) What is a pointer variable in C?

2. int var;
Use this variable to write a single line code in C to read input using scanf library function call.

In: Computer Science

Using SET operations, display a list of customers that are interested in a car (prospect table)...

Using SET operations, display a list of customers that are interested in a car (prospect table) of the same make and model which they already own.

In: Computer Science

Which command do you use to find the process that’s holding a file open? 1. w...

Which command do you use to find the process that’s holding a file open?

1.

w

2.

ps

3.

top

4.

fuser

In: Computer Science

As a second example, consider the communication paradigm referred to as queued RPC, as introduced in...

As a second example, consider the communication paradigm referred to as queued RPC, as introduced in Rover [Joseph et al. 1997]. Rover is a toolkit to support distributed systems programming in mobile environments where participants in communication may become disconnected for periods of time. The system offers the RPC paradigm and hence calls are directed towards a given server (clearly space-coupled). The calls, though, are routed through an intermediary, a queue at the sending side, and are maintained in the queue until the receiver is available. To what extent is this time- uncoupled? Hint: consider the almost philosophical question of whether a recipient that is temporarily unavailable exists at that point in time.

In: Computer Science

why are direct input and outputs highly discouraged in setters and getters

why are direct input and outputs highly discouraged in setters and getters

In: Computer Science

9. #include <fstream> #include <iostream> using namespace std; int main() {     float bmi;     ifstream...

9. #include <fstream>
#include <iostream>
using namespace std;

int main()
{
    float bmi;
    ifstream inFile;
    inFile.open("bmi.txt");

    while (!inFile.eof())
      {
         inFile >> bmi;
         if( bmi < 18.5)
          {
              cout << bmi << " is underweight " ;
          }
        else if( bmi >= 18.5 && bmi <= 24.9)
          {
              cout << bmi << " is in normal range " ;
          }
        else if( bmi >= 25.0 && bmi <= 29.9)
          {
              cout << bmi << " is overweight " ;
          }
        else if( bmi >= 30)
          {
              cout << bmi << " is obese " ;
          }
        cout << endl;
     }
   return 0;
}

bmi.txt looks like below:

25.0

17.3

23.1

37.0

What will be the output when the above code runs with the above bmi.txt file.

In: Computer Science

Sketch! This assignment is to write a Python program that makes use of the OpenGL graphics...

Sketch! This assignment is to write a Python program that makes use of the OpenGL graphics library to make an interactive sketching program that will allow the user to do line drawings. The user should be able to choose from a palette of colors displayed on the screen. When the user clicks the mouse in the color palette area, the drawing tool will switch to using the color selected, much like dipping a paint brush into a new color of paint.

Here are two starter codes. I'm trying to combine them basically but end up with a mess. It's supposed to be mimicking Microsoft Paint. Pick a color and then draw a line with it. There are 3 boxes on the left side, red, green, and blue. When the user clicks the box the line color matches the color of the box. Then the user can click in the space and free draw a line of that color, similar to Microsoft paint.









from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *

# global variables
width = 400                 # window dimensions
height = 300

menuwidth = 100             # menu dimensions
ncolors = 3                 # number of colors
boxheight = height//ncolors # height of each color box

colormenu = [[1.0,0.0,0.0], [0.0,1.0,0.0], [0.0,0.0,1.0]]
menuindex = -1

###
#  Returns true if point (x, y) is in the color menu
###
def incolormenu(x, y):

   return x >= 0 and x <= menuwidth and y >= 0 and y <= height


###
# Returns index of point (x, y) in the color menu
###
def colormenuindex(x, y):

   if not incolormenu(x, y):
      return -1;
   else:
      return y//boxheight


###
# Watch mouse button presses and handle them
###
def handleButton(button, state, x, y):

   global menuindex

   y = height - y   # reverse y, so zero at bottom, and max at top

   if button != GLUT_LEFT_BUTTON:   # ignore all but left button
      return

  
   # if button pressed and released in same menu box, then update
   # the color of the large square
  
   if state == GLUT_DOWN:
      if incolormenu(x, y):
         menuindex = colormenuindex(x, y)
   else:
      if incolormenu(x, y) and colormenuindex(x, y) == menuindex:
         glColor3f(colormenu[menuindex][0], colormenu[menuindex][1], colormenu[menuindex][2])
         glRecti(menuwidth, 0, width, height)

   glFlush()


###
# Draw the colored box and the color menu
###
def drawMenu():
   
   # clear window
   glClear(GL_COLOR_BUFFER_BIT)

   # draw the color menu
   for i in range(ncolors):
      glColor3f(colormenu[i][0], colormenu[i][1], colormenu[i][2])
      glRecti(1, boxheight * i + 1, menuwidth - 1, boxheight * (i + 1) - 1)
  
   glFlush()

###
#  Main program
###
def main():

   glutInit()

   glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA)
   glutInitWindowSize(width, height)
   window = glutCreateWindow("Color Menu")

   # callback routine
   glutDisplayFunc(drawMenu)
   glutMouseFunc(handleButton)

   # lower left of window is (0, 0), upper right is (width, height)
   gluOrtho2D(0, width, 0, height)

   # specify window clear (background) color to be black
   glClearColor(0, 0, 0, 0)
 
   glutMainLoop()

if __name__ == "__main__":
   main()





from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *

# global variables
width = 600        # window dimensions
height = 600

wleft = 0
wright = width
wbottom = 0
wtop = height

tracking = False

###
# Returns true if point (x, y) is in the window
###
def inwindow(x, y):

   return x > wleft and x < wright and y > wbottom and y < wtop

###
# Draw a line to new mouse position
###
def m_Motion(x, y):

   y = wtop - y

   if tracking and inwindow(x, y):
      glBegin(GL_LINES)
      glVertex2i(width//2, height//2)
      glVertex2i(x, y)
      glEnd()
    
   glFlush()

###
# Watch mouse button presses and handle them
###
def handleButton(button, state, x, y):
  
   global tracking

   y = wtop - y

   if button != GLUT_LEFT_BUTTON:
      return

   if state == GLUT_DOWN:
      if inwindow(x, y):
         tracking = True
   else:
      tracking = False

###
# Clear the window
###
def drawMouse():
  
   glClear(GL_COLOR_BUFFER_BIT)     # clear the window

   glColor3f(0, 0, 0)              # set mouse line color
  
   glFlush()

###
#  Main program
###
def main():

   glutInit()

   glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA)
   glutInitWindowSize(width, height)
   window = glutCreateWindow("Mouse Exam")

   # callback routine
   glutDisplayFunc(drawMouse)
   glutMouseFunc(handleButton)
   glutMotionFunc(m_Motion)

   # lower left of window is (0, 0), upper right is (width, height)
   gluOrtho2D(0, width, 0, height)

   # specify window clear (background) color to be dark grey
   glClearColor(0.7, 0.7, 0.7, 1)
 
   glutMainLoop()

if __name__ == "__main__":
   main()

In: Computer Science

//Write in C++ //use this evote code and add File I/O operations (as specified in the...

//Write in C++

//use this evote code and add File I/O operations (as specified in the comments) to it.

#include<iostream>

using namespace std;

int main()

{int choice;

int bezos = 0 , gates = 0 , bugs = 0 ;

int vc = 0 ;

do {

   cout<<"\n\n\nEVOTE\n-----"

   <<"\n1.Jeff Bezos

   <<"\n2.Bill Gates

   <<"\n3.Bugs Bunny"

// 4. Print current tally [hidden admin option]

// 5. Print audit trail [hidden admin option]

// 6. mess with the vote [hidden hacker option] E.C.

// 7. END THE ELECTION

   <<"\n\n Your selection? ";

   cin >> choice ;

   if(choice==1) {bezos++ ; vc++ ; cout<<"\nThanks for voting!"; }

   if(choice==2) {gates++ ;vc++ ; cout<<"\nThanks for voting!"; }

   if(choice==3) { bugs++ ; vc++ ; cout<<"\nThanks for voting!"; }

   if((choice<1)||(choice>7))cout<<"\nPlease enter 1-3";

   // write what happened to FILES

   // Tally.txt (overwrite) bezos x gates x bugs x

   // auditTrail.txt ios::app (everything typed) 1 2 3 3 56 -12 4

} while(choice != 7 ) ;

  

cout<<"\n\nRESULTS:\n--------"

<<"\nTotal Votes Cast This Election: "<< vc

<<"\nJeff Bezos: "<< bezos

<<"\nBill Gates: "<< gates

<<"\nBugs Bunny: "<<bugs;

  

cout<<"\n\n";

system("pause"); // leave this out if using newer DEV C++

return 0;

}

  

In: Computer Science

A) DDL For Company DB Schema, Answer the below questions: Emp (Empno, Ename, Job, Hiredate, Sal,...

A) DDL

For Company DB Schema, Answer the below questions:

Emp (Empno, Ename, Job, Hiredate, Sal, Comm, Deptno)

Dept (Deptno, Dname, loc)

1. Retrieve the data of all employees.

2. Retrieve the data of all Salemanemployees.

3. Retrieve the name and Salary of all employees.

4. Retrieve the name and salary of Salemanemployees.

5. Retrieve the name and salary of all employees with Salary more than 2000.

6. Retrieve the Name and Salary of all employees who work in department no 20.

7. Retrieve the name and Job of all employees with Salary more than 2000 and hiredate after 01-01-1981.

8. Retrieve the Job and Salary of all employees with Name = FORD or MARTIN.

9. Retrieve the Name and Number of all Departments.

10. Retrieve the Employee Name and Department number for all employees.

11. Retrieve the Employee Name and Department name for all employees.

12. Retrieve the Employee Name and who works in Department name = RESEARCH.

13. Retrieve the Employee names who workin one of these Departments: RESEARCHand SALES.

14. Retrieve the Employee name who works in department located in NEW YORK.

please write in computer word not on paper

In: Computer Science

Urgent need: please solve this question below: A description of how your chosen Information Systems Technology...

Urgent need: please solve this question below:

A description of how your chosen Information Systems Technology is currently being used in different areas of business, government or and/or society. If your technology is being used in many different areas, try and focus on four areas that either have a high impact or that interest your group. Be sure to include the impacts that the technology is having on each of these areas. Your impacts should include both quantitative (e.g., financial, etc.) as well as qualitative (e.g., quality of life, etc.) ones. In addition, describe 3-4 advantages and 3-4 disadvantages of the use of the technology in these areas. For the advantages, you should clearly describe how/why these are advantages, whether or not they are sustainable and why. For the disadvantages, you should clearly describe why they are disadvantages, how serious these disadvantages are and whether or not there are any ways to overcome these disadvantages.

In: Computer Science

Define an interface called Vehicle, which requires the following methods getName: returns a String getTopSpeed: returns...

Define an interface called Vehicle, which requires the following methods getName: returns a String getTopSpeed: returns an int getMaxPassengers: returns an int Note that the class Car implements this interface and is preloaded (in one of the following questions you will define this class)

For example:

Test

Vehicle v = new Car("BMW", 280, 5); System.out.println(v.getName()); System.out.println(v.getTopSpeed()); System.out.println(v.getMaxPassengers());

Results :

BMW

280

5

Test 2 :

Vehicle v = new Car("Smart", 150, 2); System.out.println(v.getName()); System.out.println(v.getTopSpeed()); System.out.println(v.getMaxPassengers());

Results :

Smart

150

2

In: Computer Science

Question 3 a) What kind of leadership style would you like to apply as a project...

Question 3 a) What kind of leadership style would you like to apply as a project manager to lead your team? AN b) With a typical case study example, show how you would go about your project scope management. AP c) In your own view, how can scope creep affect project success?

In: Computer Science

Create a GUI matlab code that computes for the position, velocity, and acceleration of the equation...

Create a GUI matlab code that computes for the position, velocity, and acceleration of the equation and displays their respective graph.

In: Computer Science