Questions
JAVA Input a phrase from the keyboard, if the phrase contains "red" or "RED" print out...

JAVA Input a phrase from the keyboard, if the phrase contains "red" or "RED" print out "red" . if the phrase contains "blue" or "BLUE" output "blue" In all other cases print "No Color" For example: If the input was "Violets are BLUE" your output should be "blue" If the input was "Singing the blues" output "blue" If the input was "I have a pure bred puppy" your output should be "red" If the input was "Today is Monday" output "No color". If the input was "My shirt is Blue" output "No color". (because you are only looking for "blue", "BLUE", "red", "RED")

In: Computer Science

You are required to solve the problem on Terrain Navigation. Terrain navigation is a key component...

You are required to solve the problem on Terrain Navigation.

Terrain navigation is a key component in the design of unmanned aerial vehicles (UAVs). Vehichles such as a robot or a car, can travel on land; and vehiches such as a drone or a plane can fly above the land. A UAV system contains an on board computer that has stored the terrain information for the area in which it is to be operated, Because it knows where it is at all times (often using a global positioning system (GPS) receiver), the vehicle can then select the best path to get to a designed spot. If the destination changes, the vehicle can refer to its internal maps and recompute the new path. The computer software that guides these vechicles must be tested over a variety of land formations and topologies. Elevvation information for large grids of land is available in computer databases. One way of measuring the "difficulty" of a lanad grid with respect to terrain navigation is to determine the number of peaks in the grid, where a peak is a point that has lower elevations all around it. For this problem, we want to determine whether the value in grid position [m] [n] is peak. Assume that the values in the four positions shown are adjacent to grid position [m] [n]:

grid [m-1] [n]
grid [m][n-1] grid [m][n]    grid [m][n+1]
grid [m+1] [n]

Write a program that reads elevation data from a data file named grid1. txt. (this file you have to create and name it as grid 1.txt.) data as shown below which represent elevation for a grid that has 6 points along the side and seven points along the top ( the peaks have been highlighted and underlined):

5039 5127 5238 5259 5248 5310 5299

5150 5392 5410 5401 5352 5820 5321

5290   5560    5490 5421 5530 5831    5210

5110 5429 5430 5411 5459 5630 5319

4920 5129 4921   5821 4722 4921 5129

5023 5129 4822 4872 4794 4862 4245

Then prints the number of peaks and their locations. Assume that the first line of the data file contains the number of rows and the number of columns for the grid of information. These values are then followed by the elevation values, in row order. The maximum size of the grid is 25 rows by 25 columns.

Hints:

  1. Define and print the number of peaks and their locations in an elevation grid.
  2. input is a file containing the elevation data and the output is a listing of the location of the peaks.
  3. to specify the location of the peaks, you need to assign an addressing scheme to the data because you are going to implement this solution in c. Therefore, choose its 2D array subscripting notation.
  4. assume the top left corner is position [0][0], the row numbers increase by 1 as move down the page and the column numbers increase by 1 as move to the right.
  5. These peaks then occur at position[2][1], [2][5], and [4][3].
  6. To determine the peaks, compare a potential peak with its four neighbouring points.
  7. if all four neighboring points are less that the potential peak, then the potential peak is a real peak.
  8. the points on the edges of the array or grid cannot be potential peaks because do not have elevation information on all four sides of the points.

In: Computer Science

course: Applications of mobile application development What are web services and how do mobile and web...

course: Applications of mobile application development

  • What are web services and how do mobile and web applications utilize them.
  • Research and describe SOAP web services. Are they still commonplace?
  • What are REST web services and how are they used? Please provide examples.
  • What are Websockets and how are they used? Please provide examples.
  • Research GraphQL; how does using this differ from REST?

Complete the tasks listed and submit in a word document with 3 pages length

In: Computer Science

The file pokedex.txt contains partial information about 31 Pokémon that mostly come from this Pokédex. Assignment...

  • The file pokedex.txt contains partial information about 31 Pokémon that mostly come from this Pokédex.

Assignment

  • Using pokedex.py as a starting point, supply the missing functions such that interaction with a user could produce this transcript.

Pokedex.py:

1,bulbasaur,318,grass,poison
2,ivysaur,405,grass,poison
3,venusaur,525,grass,poison
4,charmander,309,fire
5,charmeleon,405,fire
6,charizard,534,fire,flying
7,squirtle,314,water
8,wartortle,405,water
9,blastoise,530,water
10,caterpie,195,bug
11,metapod,205,bug
12,butterfree,395,bug,flying
13,weedle,195,bug,poison
14,kakuna,205,bug,poison
15,beedrill,395,bug,poison
16,pidgey,251,normal,flying
17,pidgeotto,349,normal,flying
18,pidgeot,479,normal,flying
19,rattata,253,normal
20,raticate,413,normal
21,spearow,262,normal,flying
22,fearow,442,normal,flying
23,ekans,288,poison
24,arbok,448,poison
25,pikachu,320,electric
26,raichu,485,electric,psychic
27,sandshrew,300,ground
28,sandslash,450,ground
29,nidoran,275,poison
30,nidorina,365,poison
810,yeet,777,steel,fire,water,grass,electric,psychic,ice,dragon,dark,fairy,???

Transcript:

1. Print Pokedex
2. Print Pokemon by Name
3. Print Pokemon by Number
4. Count Pokemon with Type
5. Print Average Pokemon Combat Points
6. Quit

Enter a menu option: 1

The Pokedex
-----------
Number: 1, Name: Bulbasaur, CP: 318: Type: grass and poison
Number: 2, Name: Ivysaur, CP: 405: Type: grass and poison
Number: 3, Name: Venusaur, CP: 525: Type: grass and poison
Number: 4, Name: Charmander, CP: 309: Type: fire
Number: 5, Name: Charmeleon, CP: 405: Type: fire
Number: 6, Name: Charizard, CP: 534: Type: fire and flying
Number: 7, Name: Squirtle, CP: 314: Type: water
Number: 8, Name: Wartortle, CP: 405: Type: water
Number: 9, Name: Blastoise, CP: 530: Type: water
Number: 10, Name: Caterpie, CP: 195: Type: bug
Number: 11, Name: Metapod, CP: 205: Type: bug
Number: 12, Name: Butterfree, CP: 395: Type: bug and flying
Number: 13, Name: Weedle, CP: 195: Type: bug and poison
Number: 14, Name: Kakuna, CP: 205: Type: bug and poison
Number: 15, Name: Beedrill, CP: 395: Type: bug and poison
Number: 16, Name: Pidgey, CP: 251: Type: normal and flying
Number: 17, Name: Pidgeotto, CP: 349: Type: normal and flying
Number: 18, Name: Pidgeot, CP: 479: Type: normal and flying
Number: 19, Name: Rattata, CP: 253: Type: normal
Number: 20, Name: Raticate, CP: 413: Type: normal
Number: 21, Name: Spearow, CP: 262: Type: normal and flying
Number: 22, Name: Fearow, CP: 442: Type: normal and flying
Number: 23, Name: Ekans, CP: 288: Type: poison
Number: 24, Name: Arbok, CP: 448: Type: poison
Number: 25, Name: Pikachu, CP: 320: Type: electric
Number: 26, Name: Raichu, CP: 485: Type: electric and psychic
Number: 27, Name: Sandshrew, CP: 300: Type: ground
Number: 28, Name: Sandslash, CP: 450: Type: ground
Number: 29, Name: Nidoran, CP: 275: Type: poison
Number: 30, Name: Nidorina, CP: 365: Type: poison
Number: 810, Name: Yeet, CP: 777: Type: steel and fire and water and grass and electric and psychic and ice and dragon and dark and fairy and ???

1. Print Pokedex
2. Print Pokemon by Name
3. Print Pokemon by Number
4. Count Pokemon with Type
5. Print Average Pokemon Combat Points
6. Quit

Enter a menu option: 2
Enter a Pokemon name: RAICHU
Number: 26, Name: Raichu, CP: 485: Type: electric and psychic

1. Print Pokedex
2. Print Pokemon by Name
3. Print Pokemon by Number
4. Count Pokemon with Type
5. Print Average Pokemon Combat Points
6. Quit

Enter a menu option: 2
Enter a Pokemon name: raichump
There is no Pokemon named raichump

1. Print Pokedex
2. Print Pokemon by Name
3. Print Pokemon by Number
4. Count Pokemon with Type
5. Print Average Pokemon Combat Points
6. Quit

Enter a menu option: 3
Enter a Pokemon number: 26
Number: 26, Name: Raichu, CP: 485: Type: electric and psychic

1. Print Pokedex
2. Print Pokemon by Name
3. Print Pokemon by Number
4. Count Pokemon with Type
5. Print Average Pokemon Combat Points
6. Quit

Enter a menu option: 3
Enter a Pokemon number: 34
There is no Pokemon number 34

1. Print Pokedex
2. Print Pokemon by Name
3. Print Pokemon by Number
4. Count Pokemon with Type
5. Print Average Pokemon Combat Points
6. Quit

Enter a menu option: 4
Enter a Pokemon type: Normal
Number of Pokemon that contain type normal = 7

1. Print Pokedex
2. Print Pokemon by Name
3. Print Pokemon by Number
4. Count Pokemon with Type
5. Print Average Pokemon Combat Points
6. Quit

Enter a menu option: 4
Enter a Pokemon type: ???
Number of Pokemon that contain type ??? = 1

1. Print Pokedex
2. Print Pokemon by Name
3. Print Pokemon by Number
4. Count Pokemon with Type
5. Print Average Pokemon Combat Points
6. Quit

Enter a menu option: 4
Enter a Pokemon type: unknown
Number of Pokemon that contain type unknown = 0

1. Print Pokedex
2. Print Pokemon by Name
3. Print Pokemon by Number
4. Count Pokemon with Type
5. Print Average Pokemon Combat Points
6. Quit

Enter a menu option: 5
Average Pokemon combat points = 370.71

1. Print Pokedex
2. Print Pokemon by Name
3. Print Pokemon by Number
4. Count Pokemon with Type
5. Print Average Pokemon Combat Points
6. Quit

Enter a menu option: 6
Thank you.  Goodbye!

Grading - 100 points

  • 20 points. The class Pokemon is defined (2 points) with the appropriate six methods (3 points each).
  • 5 points. The function print_menu is correct.
  • 10 points. The function print_pokedex is correct.
  • 10 points. The function lookup_by_name is correct when the Pokémon is present (7 points) and absent (3 points).
  • 10 points. The function lookup_by_number is correct when the number is present (7 points) and absent (3 points).
  • 10 points. The function total_by_type is correct when the type is present (7 points) and absent (3 points).
  • 10 points. The function average_hit_points is correct.
  • 10 points. The format of the output matches the format of the output in the transcript exactly. (2 points for each type of difference up to 10 points.)
  • 15 points - The Python solution is properly commented, easy to understand and does not contain unnecessary code. (3 points for each type of improvement up to 15 points.)

In: Computer Science

Find Consider the following context-free grammar G: S --> T#T T --> C A --> aA...

Find Consider the following context-free grammar G:
S --> T#T
T --> C
A --> aA | epsilon
B --> bB | epsilon
C --> cC
C --> c
a) Give the set of unproductive symbols in G?
b) Give an equivalent grammar without useless symbols.

In: Computer Science

(JAVA) Balanced Class diagram: Balanced + swing(int[] a) : boolean For this exercise, you will have...

(JAVA)

Balanced

Class diagram:

Balanced

+ swing(int[] a) : boolean


For this exercise, you will have to implement the class diagram above. Basically, the objective of this exercise is to develop the class and the previous method, in such a way that it tells us if an array is balanced or not.

We say that an array is balanced if the sum of the elements belonging to the first half of the array (not including the element in the middle), and the sum of the elements belonging to the second half of the array (not including the element in the middle) They are equal.

Example 1: the balance method receives the array [1,2,3,4,2]

The method returns false

Example 2: the balance method receives the array [1,2,78,3,0]

The method returns true

TIP: for this exercise, ONLY odd arrangements will be made.

In: Computer Science

Write a JAVA program to store some details of pizzas (menu item number, size, base, extra...

Write a JAVA program to store some details of pizzas (menu item number, size, base, extra cheese, extra
garlic), curries (menu item number, size, curry type) and softdrinks (menu item number, size,
flavour, bottle or can) in a single array, with the options of listing all menu items or deleting a
particular menu item.
Your program must continuously prompt the user to choose an option from a list and act on that
option, until the exit option is chosen. (See the sample output below.) If a menu item is not found,
output "Not found" instead of "Done".


You must use inheritance and polymorphism to model your Pizza, Curry and SoftDrink classes (use
those exact class names) as subclasses of the same base class, which forms the basis for the array.

Note: Be very careful to reproduce the output exactly. Copy-and-paste is highly recommended to
avoid minor typographical errors that drive you crazy when submitting online!


Sample Input/Output:
Welcome to Great International Food Court
MENU: add (P)izza, add (C)urry, add (S)oft drink, (D)elete, (L)ist,
(Q)uit
p
Enter the menu item number
123
Enter the size
12"
Enter the base
Hand-tossed
Enter extra cheese
Yes
Enter extra garlic
Yes
Done
MENU: add (P)izza, add (C)urry, add (S)oft drink, (D)elete, (L)ist, (Q)uit
c
Enter the menu item number
456
Enter the size
Large
Enter the curry type
Vindaloo
Done
MENU: add (P)izza, add (C)urry, add (S)oft drink, (D)elete, (L)ist, (Q)uit
s
Enter the menu item number
789
Enter the size
Large
Enter the flavour
Coke
Enter whether it is a bottle or can
Bottle
Done
MENU: add (P)izza, add (C)urry, add (S)oft drink, (D)elete, (L)ist, (Q)uit
d
Enter the menu item number
456
Done
MENU: add (P)izza, add (C)urry, add (S)oft drink, (D)elete, (L)ist, (Q)uit
l
Pizza: 123, 12", Hand-tossed, Yes, Yes
Soft Drink: 789, Large, Coke, Bottle
Done
MENU: add (P)izza, add (C)urry, add (S)oft drink, (D)elete, (L)ist, (Q)uit
q

In: Computer Science

b) The recent global climate change has necessitated the need for a new model for predicting...

b) The recent global climate change has necessitated the need for a new model for predicting weather patterns. Two scientists who were modeling this process in Ghana ended up with two different system models.

i) What could be the possible reason(s) for the differences in their system model? Justify your answer.

ii) In relation to real world data from the process how can you select the best model to employ for subsequent simulations and prediction of the process?

In: Computer Science

def binsearch(a): if len(a) == 1: return a[0] else: mid = len(a)//2 min1 = binsearch(a[0:mid]) min2...

def binsearch(a):
    if len(a) == 1:
        return a[0]
    else:
        mid = len(a)//2
        min1 = binsearch(a[0:mid])
        min2 = binsearch(a[mid:len(a)])
        if min1 < min2:
            return min1
        else:
            return min2

What is the time complexity for the function? include derivative steps to your answer

In: Computer Science

Can you find any proofs or explanations that hash algorithms (such as MD5 and SHA1) are...

Can you find any proofs or explanations that hash algorithms (such as MD5 and SHA1) are as good as they appear to be?

In: Computer Science

This solution is to be written in JAVA It is difficult to make a budget that...

This solution is to be written in JAVA

It is difficult to make a budget that spans several years, because prices are not stable. If your company needs 200 pencils per year, you cannot simply use this year’s price as the cost of pencils two years from now. Because of inflation, the cost is likely to be higher than it is today.

The program asks for the cost of the item, the number of years from now that the item will be purchased, and the rate of inflation. The program then outputs the estimated cost of the item after the specified period. Have the user enter the inflation rate as a percentage, such as 5.6 (percent). Your program should then convert the percent to a fraction, such as 0.056, and should use a loop to estimate the price adjusted for inflation.

In: Computer Science

2,3,1 8,7,-3 1,2 Abc 0,4,3 -1,7,10 Develop a Python program which reads all the coefficient inputs...

2,3,1
8,7,-3
1,2
Abc
0,4,3
-1,7,10

Develop a Python program which reads all the coefficient inputs from coeff.txt and find the “real” roots of the equations. The following requirements must be met:

  • If there is no real root, then it must print “No real root”
  • If the coefficients inputs are inappropriate, then it must print “equation is not valid”
  • Roots are to be found using a function
  • All the outputs are to be written to an output text file

In: Computer Science

Question 3 (1 mark) : Assume that your program has classes Family, House, LivingRoom, Bedroom,Bathroom, Kitchen....

Question 3 (1 mark) : Assume that your program has classes Family, House, LivingRoom, Bedroom,Bathroom, Kitchen. What is the most appropriate relationship among the above classes. Write a UML diagram that indicates your system architecture (classes and relationships).

In: Computer Science

In this exercise, you will create a basic data management system for students in the Department...

In this exercise, you will create a basic data management system for students in the Department of Computer Science and Information Technology using the linked list.

You must write two classes – Student class attached, and StudentChart.

Student class consists of student data. StudentChart class contains a linked list of all students in the department.

For this purpose, you must fulfill the following interfaces (note - fields of the objects should be marked as private).

Class: Student chart

Class of Student Chart contains data for all students stored in a linked list. The way to add a student to the list by method addStudent only to the front of the list. At the beginning the student list is empty, the number of students enrolled in the Department is 0. Think what would be the fields of this class, so that you can know much information at any one time.

Constructors:

Creat the class chart according to the private

StudentChart()

.fields(variables).

Methods:

Return type

Method name and parameters

operation

Add student to the front of the linked list.

void

addStudent(Student student

Delete student from the list. Do nothing if the student does not exist in the list. Returns false if student not found in the list

boolean

deleteStudent(Student student)

int

getNumOfStudents()

Returns the number of students in the list.

boolean

isStudent(Student student)

Examine if student exists in the list.

Student

getStudent(int studentNum)

Returns students data for the students with studentNum.

Returns the student average in the course with number

double

getAverage(int course)

course

Returns student average in all courses for all students.

double

getAverage()

(You can use the Student class methods).

Prints the students data for all students as follow:

Student number 1:

<Student String representation> Student number 2:

<Student String representation>

Student number <n>:

<Student String representation> If there are no students print:

void

printStudentChart()

No students!

It is recommended to write tester to present all the methods of the class and to check that they actually work.

The student class :

public class Student {
   private String name;// student name
   private long id; // student identity number
   private int [] grades = new int[5]; // list of student courses grades
   
   //costructor that initialize name and id
   public Student(String name, long id){
       String n = name.toUpperCase();
       name = name.replace(name.charAt(0), n.charAt(0));
       for(int i=0 ; i<name. length(); i++)
           if(name.charAt(i)==' ')
               name = name.replace(name.charAt(i+1), n.charAt(i+1));
       this.name = name;
       this.id=id;
       
   }
   
   //copy constructor
   public Student(Student st){
       this.name= st.name;
       this.id = st.id;
   }
   
   //return the student name
   public String getName(){
       return name;
   }
   //returns the student id number
   public long getId(){
       return id;
   }
   
   // returns the course grade accoring to parameter course(course number) 
   public int getGrade(int course){
       if(grades[course]== 0)
           return -1;
       return grades[course];
       
   }
   // set the name of student with parameter name
   public void setName(String name){
       String n = name.toUpperCase();
       name = name.replace(name.charAt(0), n.charAt(0));
       for(int i=0 ; i<name. length(); i++)
           if(name.charAt(i)==' ')
               name = name.replace(name.charAt(i+1), n.charAt(i+1));
       this.name = name;
       
   }
   
   //sets the student id with parameter id
   public void setId(long id){
       this.id = id;
   }
   //set the course grade with parameter grade 
   public void setGrade(int course, int grade){
       grades[course]= grade;
   }
    // set all the grades of the student from user
   public void setGrades(int [] g){
       for(int i=0; i< grades.length; i++)
           grades[i]=g[i];
            
   }
   //returns the student average in his course
   public double getAverage(){
       int sum= 0;
       int count =0;
       for(int i=0; i< grades.length; i++){
           if(grades[i]!=-1)
          sum=+ grades[i];
           count++;
       }
       return sum/count*1.0;// compute and return average
       
   }
   
   // takes a student object as a parameter and 
   // return true if it is the same as student parameter
   public boolean equals(Student student){
       if(student.id== this.id)
           return true;
       else
           return false;
   }
   //returns a string that represents the student object
   public String toString(){
       
       String [] g = new String[5];
       for(int i=0; i< grades.length; i++)
           if(grades[i]!= -1)
               g[i]= grades[i]+" ";
               else
               g[i]="no grade";
              
       String n1= "Name:"+ name+"\n"+ "ID:  "+ id +"\n"+ "Grades:"+"\n"+
               "Introduction to Programming - "+g[0] +"\n"+"Introduction to Management – "+g[1]+"\n"+
               "Data Structures – "+g[2]+"\n"+"Introduction to Economics – "+g[3]+"\n"+
               "Introduction to Mathematics – "+g[4];
       
       return n1;               
   }
    
}

In: Computer Science

public static BagInterface<String> intersection (BagInterface<String> bagA, BagInterface bagB) This method must return a new bag which...

public static BagInterface<String> intersection (BagInterface<String> bagA, BagInterface bagB)

This method must return a new bag which is the intersection of the two bags: bagA and bagB. An element appears in the intersection of two bags the minimum of the number of times it appears in either. For example, {1,1,2} ∩{1,1,2,2,3}= {1,1,2}. Do not forget to state the big Oof your method implementation.

two file java main and test

by netbeans java

data structure and algorithem

In: Computer Science