Create the following SQL Server queries that access the Northwind database. Place them in a zip file and place the zip file in the "drop box" for Assignment 5. Name the queries Query 1-MP5, Query2-MP5, etc. Note: These problems all require aggregate processing with GROUP BY
1. For each employee, list the employee ID, employee first name, employee last name, and count of orders taken in 1996. Place the list in descending order by the number of orders.
2. For all orders shipped in July or August, 1996, list the order ID, company name, order date, and total cost of all items ordered. Place the list in descending order by the total cost
3. For all customers from the USA, list the customer ID, company name, state, count of orders, and total order amount. Do not consider the discount. Place the list in order by state and then customer ID.
4. Same as problem 3 but limit the list to all customers who placed 3 or more orders.
5. For all items in the Grains/Cereals category, list the product ID, product name, supplier name, and last date that the product was ordered. Order the list by supplier name and product name (Hint: Use MAX and be sure to include all necessary tables)
6. The product ID, product name, and count of distinct customers who ordered that product in 1996. Place the list in descending order by the count of customers.

Answers

Answer 1

Answer:

1. SELECT e.EmployeeID, e.FirstName, e.LastName, COUNT(*) as OrderByEmployee FROM Employees e

JOIN Orders o

ON e.EmployeeID = o.EmployeeID

WHERE YEAR(o.OrderDate) = '1996'

GROUP BY e.EmployeeID,e.FirstName,e.LastName

ORDER BY OrderByEmployee DESC

2. SELECT o.OrderID,c.CustomerID, o.OrderDate,SUM((od.Quantity)*

od.UnitPrice - od.Discount)) as TotalCost FROM Orders o

JOIN [Order Details] od

ON od.OrderID = o.OrderID

JOIN Customers c

ON o.CustomerID = c.CustomerID

WHERE (MONTH(OrderDate)= 7 OR MONTH(OrderDate) = 8) and

YEAR(OrderDate) = 1996

GROUP BY o.OrderID,c.CustomerID, o.OrderDate

ORDER BY TotalCost DESC

3. SELECT c.CustomerID, c.CompanyName, c.City, COUNT(o.OrderID) as TotalOrder, SUM(od.Quantity* od.UnitPrice) as TotalOrderAmount FROM Customers c

JOIN Orders o

ON o.CustomerID = c.CustomerID

JOIN [Order Details] od

ON od.OrderID = o.OrderID

WHERE c.Country = 'USA'

GROUP BY c.CustomerID, c.CompanyName, c.City

ORDER BY c.City, c.CustomerID

4. SELECT c.CustomerID, c.CompanyName, c.City, COUNT(o.OrderID) as TotalOrder, SUM(od.Quantity* od.UnitPrice) as TotalOrderAmount FROM Customers c

JOIN Orders o

ON o.CustomerID = c.CustomerID

JOIN [Order Details] od

ON od.OrderID = o.OrderID

WHERE c.Country = 'USA'

GROUP BY c.CustomerID, c.CompanyName, c.City

HAVING COUNT(o.OrderID) > 3

ORDER BY c.City, c.CustomerID

5. SELECT p.ProductID, p.ProductName, s.ContactName as SupplierName, MAX(o.OrderDate) as LastOrderDateOfProduct FROM Products p

JOIN Categories c

ON c.CategoryID = p.CategoryID

JOIN Suppliers s

ON s.SupplierID = p.SupplierID

JOIN [Order Details] od

ON od.ProductID = p.ProductID

JOIN Orders o

ON o.OrderID = od.OrderID

where c.CategoryName = 'Grains/Cereals'

GROUP BY p.ProductID, p.ProductName, s.ContactName

ORDER BY SupplierName, p.ProductName

6. SELECT p.ProductID, p.ProductName, Count(DISTINCT c.CustomerID ) as OrderByThisManyDistinctCustomer

FROM Products p

JOIN [Order Details] od

ON od.ProductID = p.ProductID

JOIN Orders o

ON o.OrderID = od.OrderID

JOIN Customers c

ON c.CustomerID = o.CustomerID

where YEAR(o.OrderDate) = 1996

GROUP BY p.ProductID, p.ProductName

Explanation:

The six query statements returns data from the SQL server Northwind database. Note that all the return data are grouped together, this is done with the 'GROUP BY' Sql clause.


Related Questions

At a coffee shop, a coffee costs $1. Each coffee you purchase, earns one star. Seven stars earns a free coffee. In turn, that free coffee earns another star. Ask the user how many dollars they will spend, then output the number of coffees that will be given and output the number of stars remaining. Hint: Use a loop

Answers

Answer:

Explanation:

The following is written in Python, no loop was needed and using native python code the function is simpler and more readable.

import math

 

def coffee():

   dollar_amount = int(input("How much money will you be using for your purchase?: "))

   free_coffees = math.floor(dollar_amount / 7)

   remaining_stars = dollar_amount % 7

   print("Dollar Amount: " + str(dollar_amount))

   print("Number of Coffees: " + str(dollar_amount + free_coffees))

   print("Remaining Stars: " + str(remaining_stars))

Recall that within the LinkedCollection the numElements variable holds the number of elements currently in the collection, and the head variable of type LLNode holds a reference to the beginning of the underlying linked list. The LLNode class provides setters and getters for its info and link attributes. Complete the implementation of the add method:

public boolean remove (T target)
// Removes an element e from this collection such that e.equals (target)
// and returns true; if no such element exists, returns false.
find(target);
if (found)
// complete the method body
return found;

Answers

yeah its totally rghe 5fith ob dExplanation:

7. Question
HTTP status codes are codes or numbers that indicate some sort of error or info message that
occurred when trying to access a web resource. When a website is having issues on the server side,
what number does the HTTP status code start with?
17
5xx
2xx
O O O O
6xx
4xx

Answers

All server side errors start with 5XX

write essay about pokhara​

Answers

Explanation:

Pokhara is the second most visited city in Nepal, as well as one of the most popular tourist destinations. It is famous for its tranquil atmosphere and the beautiful surrounding countryside. Pokhara lies on the shores of the Phewa Lake. From Pokhara you can see three out of the ten highest mountains in the world (Dhaulagiri, Annapurna, Manasalu). The Machhapuchre (“Fishtail”) has become the icon of the city, thanks to its pointed peak.

As the base for trekkers who make the popular Annapurna Circuit, Pokhara offers many sightseeing opportunities. Lakeside is the area of the town located on the shores of Phewa Lake, and it is full of shops and restaurants. On the south-end of town, visitors can catch a boat to the historic Barahi temple, which is located on an island in the Phewa Lake.

On a hill overlooking the southern end of Phewa Lake, you will find the World Peace Stupa. From here, you can see a spectacular view of the lake, of Pokhara and Annapurna Himalayas. Sarangkot is a hill on the southern side of the lake which offers a wonderful dawn panorama, with green valleys framed by the snow-capped Annapurnas. The Seti Gandaki River has created spectacular gorges in and around the city. At places it is only a few meters wide and runs so far below that it is not visible from the top

Pokhara is a beautiful city located in the western region of Nepal. It is the second largest city in Nepal and one of the most popular tourist destinations in the country. The city is situated at an altitude of 827 meters above sea level and is surrounded by stunning mountain ranges and beautiful lakes. Pokhara is known for its natural beauty, adventure activities, and cultural significance.

One of the most famous attractions in Pokhara is the Phewa Lake, which is the second largest lake in Nepal. It is a popular spot for boating, fishing, and swimming. The lake is surrounded by lush green hills and the Annapurna mountain range, which provides a stunning backdrop to the lake.

Another popular attraction in Pokhara is the World Peace Pagoda, which is a Buddhist stupa located on top of a hill. The stupa is a symbol of peace and was built by Japanese Buddhist monks. It provides a panoramic view of the city and the surrounding mountains.

The city is also known for its adventure activities, such as paragliding, zip-lining, and bungee jumping. These activities provide a unique and thrilling experience for tourists who are looking for an adrenaline rush.

In addition to its natural beauty and adventure activities, Pokhara is also significant for its cultural heritage. The city is home to many temples, such as the Bindhyabasini Temple, which is a Hindu temple dedicated to the goddess Bhagwati. The temple is located on a hill and provides a panoramic view of the city.

Overall, Pokhara is a city that has something to offer for everyone. It is a perfect destination for those who are looking for natural beauty, adventure activities, and cultural significance. The city is easily accessible by road and air, and is a must-visit destination for anyone who is planning to visit Nepal.

This is computer and programming

Answers

Answer:yes

Explanation:because

up to 25 miles i think sorry is wrong

A two-dimensional list is suitable for storing tabular data. True False 2 A two-dimensional list is really a one-dimensional list of one-dimensional lists. True False 3 The smallest index of any dimension of a two-dimensional list is 1. True False 4 The maximum indexes of a two-dimensional list with 6 rows and 10 columns are 5 and 9, respectively. True False 5 How many elements can be stored in a two-dimensional list with 5 rows and 10 columns

Answers

Answer:

1.) True

2.) True

3.) False

4.) True

5.) 50

Explanation:

A.) Two dimensional list reperesents arrays arranges in rows and column pattern ; forming a Table design. 1 dimension represents rows whe the other stands for the column.

B.) When a 1-dimensional list is embedded in another 1 - dimensional list, we have a 2 - D list.

C.) The smallest index of any dimension of a 2-D list is 0

.D.) Given a 2-D list with 6 rows and 10 columns

Maximum dimension:

(6 - 1) = 5 and (10 - 1) = 9

Dimension = (5, 9)

E.) maximum number of elements :

5 rows by 10 columns

5 * 10 = 50 elements.

In this exercise, you are going to build a hierarchy to create instrument objects. We are going to create part of the orchestra using three classes, Instrument, Wind, and Strings. Note that the Strings class has a name very close to the String class, so be careful with your naming convention!We need to save the following characteristics:Name and family should be saved for all instrumentsWe need to specify whether a strings instrument uses a bowWe need to specify whether a wind instrument uses a reedBuild the classes out with getters and setters for all classes. Only the superclass needs a toString and the toString should print like this:Violin is a member of the String family.Your constructors should be set up to match the objects created in the InstrumentTester class.These are the files givenpublic class InstrumentTester{public static void main(String[] args){/*** Don't Change This Tester Class!** When you are finished, this should run without error.*/Wind tuba = new Wind("Tuba", "Brass", false);Wind clarinet = new Wind("Clarinet", "Woodwind", true); Strings violin = new Strings("Violin", true);Strings harp = new Strings("Harp", false); System.out.println(tuba);System.out.println(clarinet); System.out.println(violin);System.out.println(harp);}}////////////////////////////public class Wind extends Instrument{}///////////////////////////public class Strings extends Instrument{ }/////////////////////////public class Instrument{ }

Answers

Answer:

Explanation:

The following code is written in Java and creates the classes, variables, and methods as requested. The String objects created are not being passed a family string argument in this question, therefore I created two constructors for the String class where the second constructor has a default value of String for family.

package sample;

class InstrumentTester {

   public static void main(String[] args) {

       /*** Don't Change This Tester Class!** When you are finished, this should run without error.*/

       Wind tuba = new Wind("Tuba", "Brass", false);

       Wind clarinet = new Wind("Clarinet", "Woodwind", true);

       Strings violin = new Strings("Violin", true);

       Strings harp = new Strings("Harp", false);

       System.out.println(tuba);

       System.out.println(clarinet);

       System.out.println(violin);

       System.out.println(harp);

   }

}

class Wind extends Instrument {

   boolean usesReef;

   public Wind(String name, String family, boolean usesReef) {

       this.setName(name);

       this.setFamily(family);

       this.usesReef = usesReef;

   }

   public boolean isUsesReef() {

       return usesReef;

   }

   public void setUsesReef(boolean usesReef) {

       this.usesReef = usesReef;

   }

}

class Strings extends Instrument{

   boolean usesBow;

   public Strings (String name, String family, boolean usesBow) {

       this.setName(name);

       this.setFamily(family);

       this.usesBow = usesBow;

   }

   public Strings (String name, boolean usesBow) {

       this.setName(name);

       this.setFamily("String");

       this.usesBow = usesBow;

   }

   public boolean isUsesBow() {

       return usesBow;

   }

   public void setUsesBow(boolean usesBow) {

       this.usesBow = usesBow;

   }

}

class Instrument{

   private String family;

   private String name;

   public String getName() {

       return name;

   }

   public void setName(String name) {

       this.name = name;

   }

   public String getFamily() {

       return family;

   }

   public void setFamily(String family) {

       this.family = family;

   }

   public String toString () {

       System.out.println(this.getName() + " is a member of the " + this.getFamily() + " family.");

       return null;

   }

}

Suppose that a computer has three types of floating point operations: add, multiply, and divide. By performing optimizations to the design, we can improve the floating point multiply performance by a factor of 10 (i.e., floating point multiply runs 10 times faster on this new machine). Similarly, we can improve the performance of floating point divide by a factor of 15 (i.e., floating point divide runs 15 times faster on this new machine). If an application consists of 50% floating point add instructions, 30% floating point multiply instructions, and 20% floating point divide instructions, what is the speedup achieved by the new machine for this application compared to the old machine

Answers

Answer:

1.84

Explanation:

Operation on old system

Add operation = 50% = 0.5

Multiply = 30% = 0.3

Divide = 20% = 0.2

T = total execution time

For add = 0.5T

For multiplication = 0.3T

For division = 0.2T

0.5T + 0.3T + 0.2T = T

For new computer

Add operation is unchanged = 0.5T

Multiply is 10 times faster = 0.3T/10 = 0.03T

Divide is 15 times faster = 0.2T/15= 0.0133T

Total time = 0.5T + 0.03T + 0.0133T

= 0.54333T

Speed up = Old time/ new time

= T/0.54333T

= 1/0.54333

= 1.84

Write a program that will input miles traveled and hours spent in travel. The program will determine miles per hour. This calculation must be done in a function other than main; however, main will print the calculation. The function will thus have 3 parameters: miles, hours, and milesPerHour. Which parameter(s) are pass by value and which are passed by reference

Answers

def calculations(miles, hours):
milesPerHour = miles / hours
return milesPerHour

def main():
miles = input("Enter Miles driven: ")
hours = input("Enter Travel Hours: ")
print(calculations(miles, hours))

if __name__=='__main__':
main()

What are recommended CPUs?

Answers

INTEL:

It does vary depending on your PC use, however, for office work, the i5 8th Gen is a recommended CPU as it can handle the requirements for office use without stress. For Gaming and high-end use, the i9 is a recommended CPU as it can handle games easily without stress.

AMD:

AMD Ryzen 3 3300X is good for office work and can handle office scenarios and the AMD Ryzen 7 3800x is good for gaming and high-end use.

Hope this helps,

Azumayay

How are BGP neighbor relationships formed
Automatically through BGP
Automatically through EIGRP
Automatically through OSPF
They are setup manually

Answers

Answer:

They are set up manually

Explanation:

BGP neighbor relationships formed "They are set up manually."

This is explained between when the BGP developed a close to a neighbor with other BGP routers, the BGP neighbor is then fully made manually with the help of TCP port 179 to connect and form the relationship between the BGP neighbor, this is then followed up through the interaction of any routing data between them.

For BGP neighbors relationship to become established it succeeds through various phases, which are:

1. Idle

2. Connect

3. Active

4. OpenSent

5. OpenConfirm

6. Established

Which of the following is step two of the Five-Step Worksheet Creation Process?

Answers

Answer:

Add Labels.

As far as i remember.

Explanation:

Hope i helped, brainliest would be appreciated.

Have a great day!

   ~Aadi x

Add Labels is step two of the Five-Step Worksheet Creation Process. It helps in inserting the data and values in the worksheet.

What is label worksheet in Excel?

A label in a spreadsheet application like Microsoft Excel is text that offers information in the rows or columns around it. 3. Any writing placed above a part of a chart that provides extra details about the value of the chart is referred to as a label.

Thus, it is Add Labels

For more details about label worksheet in Excel, click here:

https://brainly.com/question/14719484

#SPJ2

Netscape browser is one of Microsoft products
o true
o false

Answers

Answer:

FALSE. Netscape navigator web browser was developed by Netscape Communications Corporation, a former subsidiary of AOL.

By using your own data, search engines and other sites try to make your web experience more personalized. However, by doing this, certain information is being hidden from you. Which of the following terms is used to describe the virtual environment a person ends up in when sites choose to show them only certain, customized information?

A filter bubble

A clustered circle

A relational table

An indexed environment

Answers

I believe it is a filter bubble

Answer:

A filter bubble

Explanation:

describe the major elements and issues with agile development​

Answers

Answer:

water

Explanation:

progresses through overtime

How many GPRs (General purpose registers) are in ATMEGA?

Answers

Answer:

There are 32 general-purpose 8-bit registers, RO-R31 All arithmetic and logic operations operate on those registers; only load and store instructions access RAM. A limited number of instructions operate on 16-bit register pairs.

3 uses of Microsoft word in hospital

Answers

Answer:

Using word to Write the instructions of tools fo things. Using powerpoint to show how do prepare the surgery and excel to write the time and appointments of things

Explanation:

Write a SELECT statement that returns these columns from the Orders table: The CardNumber column The length of the CardNumber column The last four digits of the CardNumber columnWhen you get that working right, add the column that follows to the result set. This is more difficult because the column requires the use of functions within functions. A column that displays the last four digits of the CardNumber column in this format: XXXX-XXXX-XXXX-1234. In other words, use Xs for the first 12 digits of the card number and actual numbers for the last four digits of the number.selectCardNumber,len(CardNumber) as CardNumberLegnth,right(CardNumber, 4) as LastFourDigits,'XXXX-XXXX-XXXX-' + right(CardNumber, 4) as FormattedNumberfrom Orders

Answers

Answer:

SELECT

CardNumber,

len(CardNumber) as CardNumberLength,

right(CardNumber, 4) as LastFourDigits,

'XXXX-XXXX-XXXX-' + right(CardNumber, 4) as FormattedNumber

from Orders

Explanation:

The question you posted contains the answer (See answer section). So, I will only help in providing an explanation

Given

Table name: Orders

Records to select: CardNumber, length of CardNumber, last 4 digits of CardNumber

From the question, we understand that the last four digits should display the first 12 digits as X while the last 4 digits are displayed.

So, the solution is as follows:

SELECT ----> This implies that the query is to perform a select operation

CardNumber, ---> This represents a column to read

len(CardNumber) as CardNumberLength, -----> len(CardNumber) means that the length of card number is to be calculated.

as CardNumberLength implies that an CardNumberLength is used as an alias to represent the calculated length

right(CardNumber, 4) as LastFourDigits, --> This reads the 4 rightmost digit of column CardNumber

'XXXX-XXXX-XXXX-' + right(CardNumber, 4) as FormattedNumber --> This concatenates the prefix XXXX-XXXX-XXXX to the 4 rightmost digit of column CardNumber

as FormattedNumber implies that an FormattedNumber is used as an alias to represent record

from Orders --> This represents the table where the record is being read.

Suppose you design a banking application. The class CheckingAccount already exists and implements interface Account. Another class that implements the Account interface is CreditAccount. When the user calls creditAccount.withdraw(amount) it actually makes a loan from the bank. Now you have to write the class OverdraftCheckingAccount, that also implements Account and that provides overdraft protection, meaning that if overdraftCheckingAccount.withdraw(amount) brings the balance below 0, it will actually withdraw the difference from a CreditAccount linked to the OverdraftCheckingAccount object. What design pattern is appropriate in this case for implementing the OverdraftCheckingAccount class

Answers

Answer:

Strategy

Explanation:

The strategic design pattern is defined as the behavioral design pattern that enables the selecting of a algorithm for the runtime. Here the code receives a run-time instructions regarding the family of the algorithms to be used.

In the context, the strategic pattern is used for the application for implementing OverdraftCheckingAccount class. And the main aspect of this strategic pattern  is the reusability of the code. It is behavioral pattern.

what is a case in programming​

Answers

Answer:

A case in programming is some type of selection, that control mechanics used to execute programs :3

Explanation:

:3

what is the address of the first SFR (I/O Register)​

Answers

Answer:

The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF.

Explanation:

The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF.

Reason -

A Special Function Register (or Special Purpose Register, or simply Special Register) is a register within a microprocessor, which controls or monitors various aspects of the microprocessor's function.

What techniques overcome resistance and improve the credibility of a product? Check all that apply.
Including performance tests, polls, or awards
Listing names of satisfied users
Sending unwanted merchandise
Using a celebrity name without authorization

Answers

Answer: Including performance tests, polls, or awards.

Listing names of satisfied users

Explanation:

For every business, it is important to build ones credibility as this is vital on keeping ones customers and clients. A credible organization is trusted and respected.

The techniques that can be used to overcome resistance and improve the credibility of a product include having performance tests, polls, or awards and also listing the names of satisfied users.

Sending unwanted merchandise and also using a celebrity name without authorization is bad for one's business as it will have a negative effect on the business credibility.

which type of secondary storage has a fast reading access among the secondary storage​

Answers

Answer:

RAM provides much faster accessing speed to data than secondary memory. By loading software programs and required files into primary memory(RAM), computer can process data much more quickly. Secondary Memory is slower in data accessing. Typically primary memory is six times faster than the secondary memory.

_____(Blank) Is the money that received regularly by an individual, for providing good or services, earnings from labor, business, or investments​

Answers

Answer:

Income is money what an individual or business receives in exchange for providing labor, producing a good or service, or through investing capital. Individuals most often earn income through wages or salary.

Explanation:

Hope It Help you

Computer programming

Answers

Here is the answer for the question

Write a function named printPattern that takes three arguments: a character and two integers. The character is to be printed. The first integer specifies the number of times that the character is to be printed on a line (repetitions), and the second integer specifies the number of lines that are to be printed. Also, your function must return an integer indicating the number of lines multiplied by the number of repetitions. Write a program that makes use of this function. That is in the main function you must read the inputs from the user (the character, and the two integers) and then call your function to do the printing.

Answers

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

    char c;

    int n1, n2;

   

 System.out.print("Enter the character: ");

 c = input.next().charAt(0);

 System.out.print("Enter the number of times that the character is to be printed on a line: ");

 n1 = input.nextInt();

 System.out.print("Enter the number of lines that are to be printed: ");

 n2 = input.nextInt();

 

 printPattern(c, n1, n2);

}

public static int printPattern(char c, int n1, int n2){

    for (int i=0; i<n2; i++){

        for (int j=0; j<n1; j++){

            System.out.print(c);

        }

        System.out.println();

    }

    return n1 * n2;

}

}

Explanation:

*The code is in Java.

Create a function named printPattern that takes one character c, and two integers n1, n2 as parameters

Inside the function:

Create a nested for loop. Since n2 represents the number of lines, the outer loop needs to iterate n2 times. Since n1 represents the number of times that the character is to be printed, the inner loop iterates n1 times. Inside the inner loop, print the c. Also, to have a new line after the character is printed n1 times on a line, we need to write a print statement after the inner loop.

Return the n1 * n2

Inside the main:

Declare the variables

Ask the user to enter the values for c, n1 and n2

Call the function with these values

37) Which of the following statements is true
A) None of the above
B) Compilers translate high-level language programs into machine
programs Compilers translate high-level language programs inton
programs
C) Interpreter programs typically use machine language as input
D) Interpreted programs run faster than compiled programs​

Answers

Answer:

B

Explanation:

its b

Answer:

A C E

Explanation:

I got the question right.

The Yuba College Library would like a program to calculate patron fines for overdue books. Fines are determined as follows: Paperbacks Regular $.20 / day with a maximum fine of $8.00 Best-Sellers $.50 / day with a maximum fine of $15.00 Magazines $.25 / day with a maximum fine of $5.00 Hardcover Books $.30 / day with a maximum fine of $23.00 The program must prompt the user to enter the following information at the keyboard. Data entry MUST be validated as required. Fines must also be calculated using a function(s). A class object should contain the methods (functions) to determine library fine. Provide a UML and description of disign.Patron’s library card number (a 4-digit number) - ValidatePatron’s namePatron’s addressType of book - ValidateNumber of days over due - ValidateA sample interactive session is shown below:Enter the patron’s card number: 2089Enter the patron’s name: Erica RobinsonEnter the patron’s address: 2234 RoadWay Trl.Enter the book’s title: The Trail Less Traveled.1. Paperback - Regular2. Paperback - Bestseller3. Magazine4. Hardcover bookEnter number corresponding to type of book (1 – 4): 4Enter the number of days overdue: 11Do you wish to perform another transaction?

Answers

Answer:

Explanation:

The following Python code creates all of the necessary functions in order to request and validate all of the inputs from the user. Once everything is entered and validated it calculates the total fee and outputs it to the user. Also calls the entire class at the end using a test variable...

class Customer:

   library_card = 0

   patrons_name = ""

   patrons_address = ""

   type_of_book = ""

   book_title = ""

   days_overdue = 0

   fee = 0.0

   book_list = ['paperback regular', 'paperback best seller', 'magazine', 'hardcover']

   def __init__(self):

       self.library_card = self.get_library_card()

       self.patrons_address = input("Patron's Address: ")

       self.book_title = input("Book Title: ")

       self.type_of_book = self.get_type_of_book()

       self.days_overdue = float(self.get_days_overdue())

       self.calculate_total()

       print("Your total Fee is: " + str(self.fee))

   def get_library_card(self):

       library_card = int(input("Enter 4-digit library card number: "))

       if (type(library_card) == type(0)) and (len(str(library_card)) == 4):

           return library_card

       else:

           print("Invalid Card number:")

           self.get_library_card()

   def get_type_of_book(self):

       type_of_book = input("Type of Book 1-4: ")

       if (int(type_of_book) > 0) and (int(type_of_book) <= 4):

           return int(type_of_book)

       else:

           print("Invalid Type")

           self.get_type_of_book()

   def get_days_overdue(self):

       days_overdue = input("Number of Days Overdue: ")

       if int(days_overdue) >= 0:

           return days_overdue

       else:

           print("Invalid number of days")

           self.get_days_overdue()

   def calculate_total(self):

       if self.type_of_book == 1:

           self.fee = 0.20 * self.days_overdue

           if self.fee > 8:

               self.fee = 8

       elif self.type_of_book == 2:

           self.fee = 0.50 * self.days_overdue

           if self.fee > 15:

               self.fee = 15

       elif self.type_of_book == 3:

           self.fee = 0.25 * self.days_overdue

           if self.fee > 5:

               self.fee = 5

       else:

           self.fee = 0.30 * self.days_overdue

           if self.fee > 23:

               self.fee = 23

test = Customer()

Is there SUM in Small basic? ​

Answers

Answer:

no

Explanation:

Define and use in your program the following functions to make your code more modular: convert_str_to_numeric_list - takes an input string, splits it into tokens, and returns the tokens stored in a list only if all tokens were numeric; otherwise, returns an empty list. get_avg - if the input list is not empty and stores only numerical values, returns the average value of the elements; otherwise, returns None. get_min - if the input list is not empty and stores only numerical values, returns the minimum value in the list; otherwise, returns None. get_max - if the input list is not empty and stores only numerical values, returns the maximum value in the list; otherwise, returns None.

Answers

Answer:

In Python:

def convert_str_to_numeric_list(teststr):

   nums = []

   res = teststr.split()

   for x in res:

       if x.isdecimal():

           nums.append(int(x))

       else:

           nums = []

           break;

   return nums

def get_avg(mylist):

   if not len(mylist) == 0:

       total = 0

       for i in mylist:

           total+=i

       ave = total/len(mylist)

   else:

       ave = "None"

   return ave

def get_min(mylist):

   if not len(mylist) == 0:

       minm = min(mylist)

   else:

       minm = "None"

   return minm

def get_max(mylist):

   if not len(mylist) == 0:

       maxm = max(mylist)

   else:

       maxm = "None"

   return maxm

mystr = input("Enter a string: ")

mylist = convert_str_to_numeric_list(mystr)

print("List: "+str(mylist))

print("Average: "+str(get_avg(mylist)))

print("Minimum: "+str(get_min(mylist)))

print("Maximum: "+str(get_max(mylist)))

Explanation:

See attachment for complete program where I use comment for line by line explanation

Other Questions
For an Na+Cl- ion pair, attractive and repulsive energies EA and ER, respectively, depend on the distance between the ions r, according to EA = -1.436/r ER =(7.32 *10-6 )/r8 For these expressions, energies are expressed in electron volts per Na+Cl- pair, and r is the distance in nanometers. The net energy EN is just the sum of the preceding two expressions For each of the following drugs:What is the physiological affect of the drug?What are the psychological affects of the drug?Are there any legitimate uses of the drug?What are the major risk for use of the drug?"1: Ecstasy2. Heroin3: LSD4: Marijuana need help geometry question central angles and arcs???pls According to Chargoff's Base Pairing rule, a strand of DNA with the bases C T A G G T will produce a complementary strand of DNA with the bases Music in Northern India is much different than Southern India. True or False Which source would be most useful fora persuasive essay with this thesis?Community service should be mandatory.o a scientific article on the benefits of community servicea webquest createdbyan elementary school student about serving meals to the homelessan encyclopedia article from the 1950s on different types of community servicethe opinion of your next-door neighbor on whether or not heI whether or not he enjoys community service The arrow in a chemical equation always points toward theA reactantB productC rightD left Consider this story problem: "Priscilla bought cheese that weighs pounds. If she divides it into portions that are each 1/8 pound, how many portions can she make?" The value 3/4 is which part of the equation? Mercury, Mars, and Earths moon all show evidence of heavy cratering from meteor impacts while Earth shows much less evidence of meteor impacts. The most reasonable conclusion to make from this data is that the early solar system had a much higher density of rocky material, buta) Earth has been resurfaced by ongoing processes.b) the rocky material was less likely to reach Earth.c) Earth formed much later, when the solar system had fewer meteors.d) the protection from impact provided by Earths atmosphere is decreasing. State the importance of wind in ecosystems. (ii) 3xy + 2y 12 8 Jamie writes -2C > -5C to compare the temperature on two January days. Explain why you agree or disagree with him A basket contains four apples, threepeaches, and four pears. You randomlyselect a piece of fruit. It is an apple or apeach. What the probability can someone help me with this? thanks Adolescence and the Teenage Crush - Intensive English 1 Benchmark 3 Question 16 Directions: Read the following article, "Adolescence and the Teenage Crush". Then, answer question 16-2516. Part A:What is the meaning of the word inclusion in paragraph 11?A to have a relationship between two peopleB to take in or comprise as a part of a whole or groupC to prevent or restrict the participation of D to be decent or correct in character or behavior Round your answer to the nearest hundredth.A?58B You carry a 20. N bag of dog food up a 6.0 m flight of stairs. How much work was done? (2x + 3) and (2x - 3) are special factors because the only thing that distinguishes between thetwo is that one has a negative term and the other does not.What is the special name for these binomials?O y-interceptsOperfect squaresO x-interceptsO conjugates1 ptsQuestion 14 What is the most effective way to combine sentences 6 and 7?(6) Background noises and sound effects cannot be adequately recorded during filming. (7) These include such things as roaring cars, galloping horses, or the gentle tapping of pencils on desks. THESE ARE THE SENTENCES Background noises and sound effects cannot be adequately recorded during filming these, including such things as roaring cars, galloping horses, or the gentle tapping of pencils on desks.. Background noises and sound effects cannot be adequately recorded during filming when they include such things as roaring cars, galloping horses, or the gentle tapping of pencils on desks..Background noises and sound effects, such as roaring cars, galloping horses, or the gentle tapping of pencils on desks, cannot be adequately recorded during filming..Background noises and sound effects cannot be adequately recorded because such things as these roaring cars, galloping horses, or the gentle tapping of pencils on desks are included during filming. helpp pleaseee asap!!