Questions
Please submit a screenshot of where your code got compiled, executed, showing the execution result Write...

Please submit a screenshot of where your code got compiled, executed, showing the execution result

Write a program/function in python that will perform the following functions, when the program is executed, to demonstrate the features of an OOP language—ADT, inheritance, and polymorphism:

  1. Prompt a list of options—the main menu, below to compute the area of selected shape with input parameters:
    1. triangle
    2. rectangle
    3. square
    4. circle
    5. parallelogram
    6. Exit
  2. Per the selected option, prompt grader to enter the corresponding required parameters as described below:
    1. base and height
    2. length and width
    3. side
    4. radius
    5. base and height
  3. Your program should validate the number of input parameter(s) and the parameter(s).
    1. If the number of parameter(s) is incorrect OR the parameter is invalid (e.g., 0 or -3), display the message—input parameter(s) is/are incorrect, and allow grader to re-enter the correct parameter(s)
    2. If the input parameter(s) is/are valid, display the computed area based on the input parameter(s), and then allow grader to go back to the main menu to select any one of options.
    3. Assuming the unit is ft for all input parameters.

Please DO NOT hard-code any input values, output values in your code.

In: Computer Science

11. List the average unit price among all the parts. Rename the column as AVG_UNIT_PRICE 12....

11. List the average unit price among all the parts. Rename the column as AVG_UNIT_PRICE

12. List the part number and part description for each part with nine characters or ten characters in the part_description. Rank your results in ascending order on part number.

15. List the number of different part stored in each warehouse, only include those warehouse with at most 3 parts.

create table sales_rep (
slsrep_number number(5) constraint pk_sales_rep primary key,
srlast       varchar2(8),
srfirst       varchar2(7),
street       varchar2(13),
city       varchar2(7),
state       varchar2(2),
zip_code   number(5),
total_commission   number(7,2),
commission_rate       number(3,2));

insert into sales_rep values(3, 'Jones', 'Mary', '123 Main', 'Grant', 'MI', 42919, 2150, .05);
insert into sales_rep values(4, 'Morton', 'Tom', '300 College', 'Flint', 'MI', 49227, 2075, .06);
insert into sales_rep values(6, 'Smith', 'William', '102 Raymond', 'Ada', 'MI', 49441, 4912.5, .07);
insert into sales_rep values(12, 'Diaz', 'Miguel', '419 Harper', 'Lansing', 'MI', 49224, 2150, .05);

create table customer
   (c_number number(3) not null,
   clast varchar2(8),
   cfirst varchar2(7),
   street varchar2(13),
   city varchar2(7),
   state varchar2(2),
   zip_code number(5),
   balance number(7,2),
   credit_limit number(4),
   slsrep_number number(3),
constraint customer_pk primary key (c_number),
constraint fk1_customer foreign key (slsrep_number) references sales_rep(slsrep_number));

insert into customer values
(124, 'Adams', 'Sally', '418 Oak', 'Lansing', 'MI', 49224, 818.75, 1000, 3);

insert into customer values
(256, 'Samuels', 'Ann', '215 Pete', 'Grant', 'MI', 49219, 21.5, 1500, 6);

insert into customer values
(311, 'Charles', 'Don', '48 College', 'Ira', 'MI', 49034, 825.75, 1000, 12);

insert into customer values
(315, 'Daniels', 'Tom', '914 Cherry', 'Kent', 'MI', 48391, 770.75, 750, 6);

insert into customer values
(405, 'Williams', 'Al', '519 Watson', 'Grant', 'MI', 49219, 402.75, 1500, 12);

insert into customer values
(412, 'Adams', 'Sally', '16 Elm', 'Lansing', 'MI', 49224, 1817.75, 2000, 3);

insert into customer (c_number, clast, cfirst, street, city, state, zip_code, balance, credit_limit) values
(522, 'Nelson', 'Mary', '108 Pine', 'Ada', 'MI', 49441, 98.75, 1500);

insert into customer values
(567, 'Dinh', 'Tran', '808 Ridge', 'Harper', 'MI', 48421, 402.40, 750, 6);

insert into customer values
(587, 'Galvez', 'Mara', '512 Pine', 'Ada', 'MI', 49441, 114.60, 1000, 6);

insert into customer values
(622, 'Martin', 'Dan', '419 Chip', 'Grant', 'MI', 49219, 1045.75, 1000, 3);

create table part (
part_number varchar2(5) constraint pk_part primary key,
part_description varchar2(12),
units_on_hand number,
item_class char(2),
warehouse_number number,
unit_price number(7,2));

insert into part
values ('AX12', 'Iron', 104, 'HW', 3, 24.95);

insert into part
values ('AZ52', 'Dartboard', 20, 'SG', 2, 12.95);

insert into part
values ('BA74', 'Basketball', 40, 'SG', 1, 29.95);

insert into part
values ('BH22', 'Cornpopper', 95, 'HW', 3, 24.95);

insert into part
values ('BT04', 'Gas Grill', 11, 'AP', 2, 149.99);


insert into part
values ('BZ66', 'Washer', 52, 'AP', 3, 399.99);

insert into part
values ('CA14', 'Griddle', 78, 'HW', 3, 39.99);

insert into part
values ('CB03', 'Bike', 44, 'SG', 1, 299.99);

insert into part
values ('CX11', 'Blender', 112, 'HW', 3, 22.95);

insert into part
values ('CZ81', 'Treadmill', 68, 'SG', 2, 349.95);

create table orders (
order_number number(5) constraint pk_orders primary key,
order_date date,
c_number number(3) constraint fk1_orders references customer(c_number));

insert into orders values (12489, '02-AUG-2013', 124);

insert into orders values (12491, '02-AUG-2013', 311);

insert into orders values (12494, '04-AUG-2013', 315);

insert into orders values (12495, '04-AUG-2013', 256);

insert into orders values (12498, '05-AUG-2013', 522);

insert into orders values (12500, '05-AUG-2013', 124);

insert into orders values (12504, '05-AUG-2013', 522);
create table order_line (
order_number number(5),
part_number varchar2(5),
number_ordered number,
quoted_price number(6,2),
constraint pk_order_line primary key (order_number, part_number),
constraint fk1_order_line foreign key (order_number) references orders(order_number),
constraint fk2_order_line foreign key (part_number) references part(part_number));

insert into order_line values (12489, 'AX12', 11, 21.95);
insert into order_line values (12491, 'BT04', 1, 149.99);
insert into order_line values (12491, 'BZ66', 1, 399.99);
insert into order_line values (12494, 'CB03', 4, 279.99);
insert into order_line values (12495, 'CX11', 2, 22.95);
insert into order_line values (12498, 'AZ52', 2, 12.95);
insert into order_line values (12498, 'BA74', 4, 24.95);
insert into order_line values (12500, 'BT04', 3, 149.99);
insert into order_line values (12504, 'CZ81', 2, 325.99);

In: Computer Science

prove it's correct or not. A particular version of MERGESORT breaks the array into three equal...

prove it's correct or not.

A particular version of MERGESORT breaks the array into three equal parts, recursively sorts the first two parts, merges them, recursively sorts the last part, and merges it with the already merged parts one and two. This MERGESORT has the same worst-case running time as the standard version.

In: Computer Science

Modify the FeetInches class so that it overloads the following operators: <= >= != Demonstrate the...

Modify the FeetInches class so that it overloads the following operators:

<=

>=

!=

Demonstrate the class's capabilities in a simple program.

this is what needs to be modified

// Specification file for the FeetInches class

#ifndef FEETINCHES_H

#define FEETINCHES_H

#include <iostream>

using namespace std;

class FeetInches; // Forward Declaration

// Function Prototypes for Overloaded Stream Operators

ostream &operator << (ostream &, const FeetInches &);

istream &operator >> (istream &, FeetInches &);

// The FeetInches class holds distances or measurements

// expressed in feet and inches.

class FeetInches

{

private:

int feet; // To hold a number of feet

int inches; // To hold a number of inches

void simplify(); // Defined in FeetInches.cpp

public:

// Constructor

FeetInches(int f = 0, int i = 0)

{ feet = f;

inches = i;

simplify(); }

// Mutator functions

void setFeet(int f)

{ feet = f; }

void setInches(int i)

{ inches = i;

simplify(); }

// Accessor functions

int getFeet() const

{ return feet; }

int getInches() const

{ return inches; }

// Overloaded operator functions

FeetInches operator + (const FeetInches &);

FeetInches operator - (const FeetInches &);

FeetInches operator ++ (); // Prefix ++

FeetInches operator ++ (int); // Postfix ++

bool operator > (const FeetInches &);

bool operator < (const FeetInches &);

bool operator == (const FeetInches &);

// New operators

bool operator >= (const FeetInches &);

bool operator <= (const FeetInches &);

bool operator != (const FeetInches &);

// Conversion functions

operator double();

operator int();

// Friends

friend ostream &operator << (ostream &, const FeetInches &);

friend istream &operator >> (istream &, FeetInches &);

};

#endif

In: Computer Science

Write a program to input the coefficients of a quadratic equation and solve roots for all...

Write a program to input the coefficients of a quadratic equation and solve roots for all cases (including complex roots). VBA.

x=(b ^2) - (4ac)

I have it for 2 complex and 2 real and repeated.

Is that all cases?

In: Computer Science

Write a program that defines an animal data type, with an animal name, age, and category...

Write a program that defines an animal data type, with an animal name, age, and category (cat, dog, etc.), as well as an animal array type that stores an array of animal pointers. (ex.

structType *arr[size];) Your program will prompt the user to enter the data for as many animals as they wish. It will initialize a dynamically allocated animal structure for each animal, and it will store each animal in an instance of the animal array structure. Your program will then print all the animal information to the screen. You will upload your C program as one file.

In: Computer Science

Why would you use "using namespace" inside of your function instead of the above main?- Give...

  1. Why would you use "using namespace" inside of your function instead of the above main?- Give examples

In: Computer Science

1. Write Python code to - (a) ask user to enter a list of animals, one...

1. Write Python code to -
(a) ask user to enter a list of animals, one item at a time, until “done” to terminate input
(b) randomly display a selected item from the list, starting with “I like ______”.

When run, the output should look something like this:

Enter an item; 'done' when finished: cats
Enter an item; 'done' when finished: dogs
Enter an item; 'done' when finished: guinea pigs
Enter an item; 'done' when finished: done
You are done entering items.
I like guinea pigs

2. Given the following two strings:

str_1 = "the rain! in Spain falls mainly on the plains"

str_2 = "cats don't like dogs and mice. What a day."

Implement logic to produce the following output by manipulating str_1 and str_2.      

# Output ---> rain! What a day.

In: Computer Science

Write a program that sorts prices of 10 tacos in ascending order based on the price,...

Write a program that sorts prices of 10 tacos in ascending order based on the price, using arrays.

Requirements:

  • The user enters the name of the taco and then the price of the taco
    • HINT: Two arrays make this problem simpler. One with the names and the other with the prices. The indices indicate the combination. For instance, a taco price at index 5 has its name also at index 5 of the other array.
    • HINT: It is a good idea that after using keyboard.nextDouble() to write the following line: keyboard.nextLine();. The scanner will not consume everything in the buffer unless you tell it to using nextLine.
  • After 10 tacos are entered they are sorted based on the price
    • You can use any sorting method such as bubble sort or selection sort
  • Display the results at the end
  • Arrays must be part of the solution, and other built in Java data structures, such as ArrayLists, may not be used.
  • Sorting must be implemented (bubble sort, selection sort, etc.) in the solution, and other built in Java sorters may not be used.

Example Output

Welcome to the taco price sorter! Enter 10 taco names and prices and I'll sort it!

Enter the name of taco 1

Crunchy Taco

Enter taco's price

1.19

Enter the name of taco 2

Crunchy Taco Supreme

Enter taco's price

1.59

Enter the name of taco 3

Soft Taco

Enter taco's price

1.19

Enter the name of taco 4

Soft Taco Supreme

Enter taco's price

1.59

Enter the name of taco 5

Chicken Soft Taco

Enter taco's price

1.79

Enter the name of taco 6

Crispy Potato Soft Taco

Enter taco's price

0.99

Enter the name of taco 7

Double Decker Taco

Enter taco's price

1.89

Enter the name of taco 8

Double Decker Taco Supreme

Enter taco's price

2.29

Enter the name of taco 9

Doritos Locos Taco (Nacho Cheese)

Enter taco's price

1.49

Enter the name of taco 10

Doritos Locs Tacos(Fiery) Supreme

Enter taco's price

1.89

Sorted Tacos are

Taco Prices Crispy Potato Soft Taco 0.99

Taco Prices Crunchy Taco 1.19

Taco Prices Soft Taco 1.19

Taco Prices Doritos Locos Taco (Nacho Cheese) 1.49

Taco Prices Crunchy Taco Supreme 1.59

Taco Prices Soft Taco Supreme 1.59

Taco Prices Chicken Soft Taco 1.79

Taco Prices Double Decker Taco 1.89

Taco Prices Doritos Locs Tacos(Fiery) Supreme 1.89

Taco Prices Double Decker Taco Supreme 2.29

In: Computer Science

Consider the problem of multiplying n rectangular matrices discussed in class. Assume, in contrast to what...

Consider the problem of multiplying n rectangular matrices discussed in class. Assume, in contrast to what we did in class, that we want to determine the maximum number of scalar multiplications that one might need (that is, compute the maximum of all possible parenthesizations). Formulate precisely an algorithm that determines this value. Then carry out your method on the following product to show what is the worst-possible parenthesization and how many scalar multiplications are required to carry it out: M9,1*M1,9*M9,2*M2,8*M8,4.

In: Computer Science

Create an Java application that uses a class to convert number grades to letter grades and...

Create an Java application that uses a class to convert number grades to letter grades and another class for data validation.

Specifications

  • The Grade class should have only one Instance Variable of type int.
  • Use a class named Grade to store the data for each grade. This class should include these three methods:

  public void setNumber(int number)   public int getNumber()

  public String getLetter()

  • The Grade class should have two constructors. The first one should accept no parameters and set the initial value of the number instance variable to zero. The second should accept an integer value and use it to set the initial value of the number instance variable.
  • The grading criteria are as follows:

A 88-100
B 80-87
C 67-79
D 60-66
F <60

  • Use the Console class presented in chapter 7 or an enhanced version of it to get and validate the user’s entries.
  • Overload the getString() method of the Console class to add the ability to require a string value, and to require one of two specified string values.
  • When the user responds to the Continue prompt, the application should only accept a value of “y” or “n”.
  • Use ch07_LineItem for concept of different classes and using Console class for application.

im having some issue getting the overloading of the three string functions to pass values and validate the required entry validation

public class Console {

// require the user to input a value
public static String getString(String prompt) {
return getString(prompt, false);

}

// check that an input has been entered if not return an error   

public static String getString(String prompt, boolean required) {
String choice = "";
Scanner scanner = new Scanner(System.in);

//repeat until a valid input is entered
while (true) {
System.out.print(prompt);
if (choice.isEmpty() && required == true) {
choice = scanner.next();
if (scanner.hasNext()) {
choice = scanner.next();
System.out.println("Error! y or n. Try again.");
}
} else{
}
scanner.nextLine(); // discard any other data entered on the line
}
return getString(prompt,"y", "n");
}

// require one of two specified string values.

public static String getString(String prompt, String choiceOne, String choiceTwo) {
String choice = "";
boolean isValid = false;
Scanner scanner = new Scanner(System.in);

//repeat until a valid input is entered
while (!isValid) {
System.out.print(prompt);

if (scanner.hasNext()) {
choice = scanner.next(); // read user entry
//check if valid input is entered, if yes set isValid to true
if (choice.equalsIgnoreCase(choiceOne) || choice.equalsIgnoreCase(choiceTwo)) {
isValid = true;
} else { //else display error message
System.out.println("Error! y or n. Try again.");
}
} else {

System.out.println("Error! y or n. Try again.");
}
scanner.nextLine(); // discard any other data entered on the line
}
return choice;
}

public static int getInt(String prompt) {
int i = 0;
boolean isValid = false;
Scanner scanner = new Scanner(System.in);

while (!isValid) {
System.out.print(prompt);
if (scanner.hasNextInt()) {
i = scanner.nextInt();
isValid = true;

} else {
System.out.println("Error! Invalid integer. Try again.");
}
scanner.nextLine(); // discard any other data entered on the line
}

return i;

}
}

import java.util.Scanner;

public class Grade {

private int grade;

Grade() {
grade = 0;
}

Grade(int marks) {
this.grade = marks;
}

public void setNumber(int number) {
this.grade = number;
}

public String getLetter() {
if (grade >= 88) {
return "A";
} else if (grade >= 80) {
return "B";
} else if (grade >= 67) {
return "C";
} else if (grade >= 60) {
return "D";
} else if (grade < 60) {
return "F";
}
return "";
}


public String toString() {
return "Letter Grade : " + getLetter();
  
}
}

public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

System.out.println("Welcome to the Letter Grade Converter");
System.out.println();

String choice = "y";
  
while (choice.equalsIgnoreCase("y")) {

  
  
int myGrade = Console.getInt("Enter numerical grade: ");
Grade grade = new Grade(myGrade);
System.out.println("Letter grade: " + grade.getLetter());
  
  
choice = Console.getString("Continue? (y/n):");
  
}
}
}

In: Computer Science

What is 802.1X enterprise mode and why large firms uses this mode? Which network component will...

What is 802.1X enterprise mode and why large firms uses this mode? Which network component will play the role of Authenticator in the wireless settings? How does this extension protect the network?

In: Computer Science

Problem Description: Using Python write a Singly‐Linked List (with only the Head pointer) that supports the...

Problem Description: Using Python write a Singly‐Linked List (with only the Head pointer) that supports the following operations: 1. Adding an element at the middle of the list. 2. Removing the middle element of the list (and return the data). 3. Adding an element at a given index. 4. Removing an element at a given index (and return the data). For #1 and #2, ignore the operations if the length of the list is an even number. For #3, if there is already an element at the specified index, it (and everything coming before it) should be shifted left. if the specified index is beyond the existing list, then add the new element at the end of the list. For #4, ignore the operation if there is no item at the specified index. For each of these operations, design appropriate test cases for exhaustively testing the operation, and show the contents of the list before and after executing each test by grouping test case inputoutputs for a given operation to ensure readability.

Note: You have to use the linked list skeleton code provided with this document as a starter code for your solution. You CANNOT use any of the other methods (such as addBefore(), removeAfter(), search(), etc.)

class Node:
"""Node class for a linked list"""
  
def __init__(self, item=None):
"""constructor for the Node class"""
self._item = item
self._next = None
  
def __str__(self):
return str(self._item)
  

class SLL_H:
  
def __init__(self):
self._head = None
  
def __str__(self):
"""overloaded function for converting the linked list to a string"""

str_rep = ""
curr = self._head
  
str_rep +="Head-> "

while(curr):
str_rep +=str(curr._item)
str_rep +=" -> "
curr = curr._next
str_rep +="None"
  
return str_rep

In: Computer Science

In Express Sessions (in the context of React), how are session IDs typically verified?

In Express Sessions (in the context of React), how are session IDs typically verified?

In: Computer Science

C++, Complete this program as directed // This program will read in a group of test...

C++, Complete this program as directed

// This program will read in a group of test scores (positive integers from 1 to 100)
// from the keyboard and then calculate and output the average score
// as well as the highest and lowest score. There will be a maximum of 100 scores.
// PLACE YOUR NAME HERE
#include <iostream>
using namespace std;
typedef int GradeType[100]; // declares a new data type:
// an integer array of 100 elements
float findAverage (const GradeType, int); // finds average of all grades
int findHighest (const GradeType, int); // finds highest of all grades
int findLowest (const GradeType, int); // finds lowest of all grades
int main()
{
GradeType grades; // the array holding the grades.
int numberOfGrades; // the number of grades read.
int pos; // index to the array.
float avgOfGrades; // contains the average of the grades.
int highestGrade; // contains the highest grade.
int lowestGrade; // contains the lowest grade.
// Read in the values into the array
pos = 0;
cout << "Please input a grade from 1 to 100, (or -99 to stop)" << endl;

cin >> grades[pos];
while (grades[pos] != -99)
{
// Fill in the code to read the grades
}
numberOfGrades = ; // Fill blank with appropriate identifier
// call to the function to find average
avgOfGrades = findAverage(grades, numberOfGrades);
cout << endl << "The average of all the grades is " << avgOfGrades << endl;
// Fill in the call to the function that calculates highest grade
cout << endl << "The highest grade is " << highestGrade << endl;
// Fill in the call to the function that calculates lowest grade
// Fill in code to write the lowest to the screen
return 0;
}
//********************************************************************************
// findAverage
//
// task: This function receives an array of integers and its size.
// It finds and returns the average of the numbers in the array
// data in: array of floating point numbers
// data returned: average of the numbers in the array
//
//********************************************************************************
float findAverage (const GradeType array, int size)
{
float sum = 0; // holds the sum of all the numbers
for (int pos = 0; pos < size; pos++)
sum = sum + array[pos];
return (sum / size); //returns the average

}

//****************************************************************************
// findHighest
//
// task: This function receives an array of integers and its size.
// It finds and returns the highest value of the numbers in the array
// data in: array of floating point numbers
// data returned: highest value of the numbers in the array
//
//****************************************************************************
int findHighest (const GradeType array, int size)
{
/ Fill in the code for this function
}
//****************************************************************************
// findLowest
//
// task: This function receives an array of integers and its size.
// It finds and returns the lowest value of the numbers in the array
// data in: array of floating point numbers
// data returned: lowest value of the numbers in the array
//
//****************************************************************************
int findLowest (const GradeType array, int size)
{
// Fill in the code for this function
}

In: Computer Science