Questions
Please type answer for i can copy it. Thank you very much. -Question 1 What is...

Please type answer for i can copy it. Thank you very much.

-Question 1

What is a polymorphism ?

-Question 2

Can you start an algorithm in pseudo code?


language is in (OOP) object oriented programming

In: Computer Science

1.Write complete programs. These programs should be able to compile and run. No psuedocode is allowed....

1.Write complete programs. These programs should be able to compile and run. No psuedocode is allowed. No comments are needed. These programs will be graded for syntax, semantics, and programming style.

Write a complete program to display the following output:
Plan to be
spontaneous tomorrow.

2.

Write complete programs. These programs should be able to compile and run. No psuedocode is allowed. No comments are needed. These programs will be graded for syntax, semantics, and programming style.

Write a complete program to display the results for the area of a triangle. Formula (1/2) x base x height.  

In: Computer Science

I am having trouble with printing the linked list from user input. Can someone tell me...

I am having trouble with printing the linked list from user input. Can someone tell me what I am doing wrong.

#include <iostream>
using namespace std;
struct node
{
   int info;
   node*link;
   node*current;
   node*prev;
   node * head;
   node * last;
}
;

void Insert(node*&head,node*&last,int n);
int SplitList(node*&head);
void print(node*&head);
int main()
{
   int num;
   node*h;
   node*l;
   cout << "Enter numbers ending with -999" << endl;
   cin >> num;
   Insert(h, l, num);
   print(h);
}

void Insert(node *&head,node*&last,int n)
{
   int count = 0;
   if (head == NULL)
   {
       head = new node;
       head->info = n;
       head->link = NULL;
       last = head;
       count++;
   }
   else {
       last->link = new node;
       last->link->info = n;
       last->link->link = NULL;
       last = last->link;
       count++;
   }
}
void print(node*&head)
{
   node *current; //pointer to traverse the list
   current = head; //set current so that it points to
                   //the first node
   while (current->link!= NULL) //while more data to print
   {
       cout << current->info << " ";
       current = current->link;
   }
}//end print

In: Computer Science

In java, write a program that asks the user to enter a character. Then pass the...

In java, write a program that asks the user to enter a character. Then pass the character to the following methods.

  1. isVowel() – returns true if the character is a vowel
  2. isConsonant() – returns true if the character is a consonant
  3. changeCase() – if the character is lower case then change it to upper case and if the character is in upper case then change it to lower case. (return type: char)

Example output is given below:

Enter a character

a

a is a vowel

a is not a consonant

a is equivalent to A

test case: e, E, d, D

Note: Java represents character using Unicode encoding and ‘A’ to ‘Z’ is represented by numbers 65 to 90 and ‘a’ to ‘z’ is represented by numbers 97 to 122. So to convert ‘A’ to ‘a’ you need to add (97-65) to A and then cast it to Character type since the addition will change its type to integer.

You can use the following code to read a character from console. When you call charAt(i) method for any String it returns the character at index i. The index of first character is 0, the index of second character is 1 and so on.

Scanner input = new Scanner(System.in);

char ch =input.next().charAt(0);

In: Computer Science

Imagine you are responsible for the performance improvement of an old computer system. Your boss told...

Imagine you are responsible for the performance improvement of an old computer system. Your boss told you that since a large budget for the new fiscal year has been approved and covers expenses with hardware upgrade you can just create a cluster computer with a large number of parallel processing units managed by some cluster operating system line MS-Windows Server 2019. You will not be able to make any changes to the software. Please, provide your recommendations for your boss regarding performance improvement by increasing parallel processing.

In: Computer Science

Your objective is to write a well-documented simple program using classes, a loop, and nested ifs...

Your objective is to write a well-documented simple program using classes, a loop, and nested ifs to simulate an ATM using JAVA.

1. Create an ATM class with class variables name, pin, and balance, a constructor with parameters to assign values to the three instance variables, methods to get the name, pin, and balance, and methods to handle validated deposits and withdrawals ( deposit and withdrawal amounts cannot be negative, and withdrawal amount must not be greater than the existing balance).

2. In the ATMTest class, read the names, 4 digit pin numbers, and account balances of two customers into two instances of the ATM class. Display the two customers names, pins, and balances formatted.

3. Now that you have all your customers’ information start your ATM to accomplish the following within an infinite loop,

a). Display a welcome screen with your bank’s information and prompt for and read the customer entered pin.

b). Use a nested if to match the entered pin with one of the two customers’ pins. If the entered pin number matches that of one of the customers, then:

i. Welcome the customer by name and display the balance.

ii. Display option to 1. DEPOSIT, 2. WITHDRAW or 3. EXIT.

iii. If option 1 is selected, then use the instance deposit method to prompt for deposit amount, read, and add a valid deposit amount to the customer’s balance

iv. If option 2 is selected, then use the instance withdrawal method to subtract a valid withdrawal amount from the customers balance

v. If option 3 is selected, go to step a.

4. Should the entered pin number not match either of the two customers, notify the customer that the entered pin is not valid and go to step a.

5. Selection of the EXIT option must display welcome/login screen (step a).

6. Should an incorrect option be entered, notify the user and display the original welcome/login screen (step a).

In: Computer Science

Show the step by step multiplication using Booth’s Algorithm 1. -8 * 2

Show the step by step multiplication using Booth’s Algorithm

1. -8 * 2

In: Computer Science

I need the program to continue asking the user for a positive value and NOT skip...

I need the program to continue asking the user for a positive value and NOT skip to the value for store 2 if a negative value is entered. This is the code so far: Thanks

public static void main(String[] args) {
  

       Scanner input = new Scanner(System.in);//scanner
       int Store [] = new int[5];//array for five int
      
       for(int i=0;i<5;i++) { // loops until five inputs are entered

           System.out.println("Enter today's sale for store "+ (i+1) +" (negative value not allowed)");

               Store [i] = input.nextInt();//allows user input
               }// end of for

       System.out.println("SALES BAR CHART");

       for(int i =0; i<5 ;i++) { // for loop to print out store number

       System.out.println("Store "+ (i+1) +": ");

       for(int j=0; j < Store [i];j =j+100) { // for loop to print number of asterisks

                   System.out.print("*");
                       }// end of for loop for asterisks
                   System.out.println();
               }// end of for loop
           }//end of main
       }//end of class

In: Computer Science

Proofs For this assignment, know that: An integer is any countable number. Examples are: -3, 0,...

Proofs

For this assignment, know that:

An integer is any countable number. Examples are: -3, 0, 5, 1337, etc.

A rational number is any number that can be written in the form a/b, a and b are integers in lowest terms, and b cannot equal 0. Examples are 27, 22/7, -3921/2, etc.

A real number is any number that is not imaginary or infinity. Examples are 0, 4/3, square root of 2, pi, etc.

  1. Prove by cases that for all real numbers | x + y | <= |x| + |y|
  2. Prove by contradiction that the average of three real numbers is greater than or equal to at least one of the numbers

In: Computer Science

JAVA Write a program that will accept user input for an initial deposit and a total...

JAVA

Write a program that will accept user input for an initial deposit and a total amount the user wants to have, and will output the number of years it will take to reach his/her goal.

For the basic program, the user will deposit the initial amount in a new account, and then the account will receive interest, compounded MONTHLY, at a rate of 0.5%.

In: Computer Science

Anna is a young ambitious programmer working for a small company developing software for web based...

Anna is a young ambitious programmer working for a small company developing software for web based services in the health area, with a focus on support to remote aboriginal communities. To further her career Anna undertakes additional tertiary study, with support from her manager, Brian. This study includes topics covering computer ethics, and issues relating to the impact of ICT on different communities. On her current project, Anna develops a new user interface, which has a strong focus on accessibility for remote communities, especially considering the type of technology likely to be used. She also pays special attention to the use of cultural images in the interface, to avoid those which may be distressing or offensive to aboriginal users. The new system is a great success and Anna’s contribution is recognised by her company, through an Employee of the Month Award. The company also receives a national business award for its contribution to the positive use of ICT in aboriginal communities. Brian takes all of the credit for this, and Anna receives no acknowledgement for her efforts. Source:

ACS Case Studies 2014 Essay

Questions 1. Assess the major ethical issues in this business case.

2. How may the ACS Code of Professional Conduct assist in resolving such ethical implications? Relate to the key values and clauses of the Code of Professional Conduct.

In: Computer Science

This project is of Java OOP. Comprehensive UML Diagram of Managing customers for Hotel Management project...

This project is of Java OOP.
Comprehensive UML Diagram of Managing customers for Hotel Management project Mwith complete labelling of attributes, subclasses.

In: Computer Science

Use this code to answer the following questions:           Object obj;           String str;           Song...

Use this code to answer the following questions:

          Object obj;

          String str;

          Song sng = new Song("Rockstar", 5);

          obj = sng;              // #7

          sng = str;              // #8

          str = (String) obj;     // #9

          sng = obj;              // #10

1a)  Write the start of the class declaration for a node in a linked list (give the name of the class and the instance variables). The name of the node should be SpecialNode. The data in each SpecialNode will include both a String and a Song object.

b)  Using the SpecialNode class you created in question #11, write a constructor forSpecialNode that has three parameters and initializes all the SpecialNode instance variables.

c)  Write a line of code to instantiate a SpecialNode object to initialize the SpecialNodeinstance variables. Use the constructor you wrote in the previous question.

Song rockstar = new Song("Rockstar", 5);

SpecialNode sn = ___________________________________ ;

In: Computer Science

1. Write a method called isPalindrome that accepts a string as a parameter and returns true...

1. Write a method called isPalindrome that accepts a string as a parameter and returns true if the string is a palindrome otherwise returns false. This method uses a stack and a Queue to test whether the given string parameter is a palindrome [ that is, whether the characters read the same both forward and backward. For example “race car”, and “Are we not drawn onward, to new era.” are Palindromes] They are palindrome sentences, not just a word. 2. If a string is a palindrome, do not print it out, just print a message that the given string is a Palindrome. If a string is not a palindrome, print the letters of the string in reverse order. 3. Your application prompts the user for the input string. 4. You must use a stack and a queue to do this. (You have to figure out how both can be used.) Any solution that does not use a stack and a queue for the palindrome checking and reversing the letters of the words of the sentence will receive a grade of 0.

In: Computer Science

1. Implement a method called count with the following signature: public int count(); such that the...

1. Implement a method called count with the following signature:

public int count();

such that the method returns the number of nodes currently contained in the list. The method must compute this number by traversing the entire list.

2. Implement a method called sndLast with the following signature:

public E sndLast();

such that the method returns the data stored at the second-to-last node of the linked list. If the size of the list is less than 2, then the method should return null. Hint: Recall, the last node of the list has its next eld set to null.

3. Implement a method called reverse with the following signature:

public SinglyLinkedList reverse();

such that the method returns a reference to a new linked list, containing the same elements as the current list, except in the reverse order. Page

// SinglyLinkedList.java

package LinkedLists;

public class SinglyLinkedList<E> {
   private static class node<E> {
       private node<E> next; // Pointer to the next node in the list.
       private E data; //Contains a reference to the data stored at this node.
       public node(E e, node<E> n) {
           next = n;
           data = e;
       }
       public node<E> getNext() { return next; }
       public E getData() { return data; }
       public void setNext(node<E> n) { next = n; }
   }
   private node<E> head = null; //Pointer to the head of the list.
   private node<E> tail = null; //Pointer to the tail of the list.
   private int size = 0; //Track the number of nodes in the list.
   public SinglyLinkedList() { }
   //Methods begin here//
   public int getSize() { return size; }
   public boolean isEmpty() { return size == 0; }
   public E first() {
       if(isEmpty()) {
           return null;
       }
       return head.getData();
   }
   public E last() {
       if(isEmpty()) {
           return null;
       }
       return tail.getData();
}
   public void addFirst(E e) {
       node<E> n = new node<>(e,head);
       head = n;
       if(isEmpty()) {
           tail = n;
       }
       size++}   
}
   public void addLast(E e) {
       node<E> n = new node<>(e, null);
       if(isEmpty()) {
           head = n;
       } else {
           tail.setNext(n);
}
       tail = n;
       size++;
}
   public E removeFirst() {
       // Check for the empty list.
       if(isEmpty()) {
           return null;
       }
       E val = head.getData();
       head = head.getNext();
       size--;
       if(size == 0) {
           tail = null;
       }
       return val;
}
   // WARNING: print method is not efficient in general.
   public void print() {
       node<E> walk = head;
       int counter = 0;
       while(walk != null) {
           System.out.println("Count = " + (counter+1) + " " + walk.getData());          
           walk = walk.getNext();
           counter++;
       }  
}
   // WARNING: find is not efficient in general.
   public boolean find(E x) {
       node<E> walk = head;
       while(walk != null) {
           if(walk.getData().equals(x)) {
               return true;
           }
           walk = walk.getNext();
       }
       return false;
   }
   // Equality for linked lists given by definition.
   public boolean equals(Object o) { // accept ANY parameter value
       if( o == null) { return false; {
       if(getClass() != o.getClass()) { return false; } // Return false if types are not the same
       SinglyLinkedList y = (SinglyLinkedList) o;
       if(size != y.getSize()) { return false; }
       node walkA = head; // Start of THIS list.
       node walkB = y.head;
       while(walkA != null) {
           if(!walkA.getData().equals(walkB.getData())) { return false; }
           walkA = walkA.getNext();
           walkB = walkB.getNext();  
}
       return true;
}
   public SinglyLinkedList<E> clone() throws CloneNotSupportedException {
       SinglyLinkedList<E> other = (SinglyLinkedList<E>) super.clone();
       if(size > 0) { //Build independent chain of nodes.  
       }
   }
}

//SinglyLinkedListTest.java

package applications;

import LinkedLists.SinglyLinkedList;
import java.util.Random;

public class SinglyLinkedListTest {

   public static class Record {
       private int id;
       private String name;
       private double grade;
       public Record(int i, String n, double g) {
           id = i;
           name = n;
           grade = g;
       }
       public String getName() { return name; }
       public double getGrade() { return grade; }
       public String toString() {return name + " " + grade;
       }
   }
   public static void main(String[] args) {
       SinglyLinkedList<Record> L4 = new SinglyLinkedList<>();
       L4.addLast(new Record(0, "name", 4.0));
       L4.addLast(new Record(1, "name2", 3.6));
       //L4.print();
      
       SinglyLinkedList<Integer> L1 = new SinglyLinkedList<>();
       L1.addLast(35); // 35 is auto-boxed to type Integer
       L1.addLast(67);
       L1.addLast(99);
       L1.addLast(202);
       L1.addLast(11);
       L1.addLast(302);
       //L1.print();
      
       SinglyLinkedList<String> L2 = new SinglyLinkedList<>();
       L2.addLast("hello");
       L2.addLast("world");
       L2.addLast("java");
       //L2.print();
      
       SinglyLinkedList<Double> L3 = new SinglyLinkedList<>();
       L3.addLast(3.14);
       L3.addLast(3.1415);
       L3.addFirst(2.7);
       //L3.print();
      
       int size = 100;
       SinglyLinkedList<Integer> L5 = new SinglyLinkedList<>();
       Random r = new Random();
      
       System.out.println("Starting random numbers!");
       for(int i = 0; i < size; i++) {
          
           L5.addLast(r.nextInt());
      
          
       }
       System.out.println("End of list generation!");
       //L5.print();
       L5.addLast(r.nextInt());
       //L5.print();
       System.out.println("End of insert operation!");
       L5.addLast(0);
       System.out.println(L5.find(0));
      
       System.out.println(L2.equals(L5));
      
       SinglyLinkedList<String> L6 = new SinglyLinkedList<>();
       L6.addLast("hello");
       L6.addLast("world");
       L6.addLast("java");
      
       System.out.println(L2 == L6);
       System.out.println(L2.equals(L6));
      
   }
  
}

In: Computer Science