1. Copy the countdown function from Section 5.8 of your textbook.
def countdown(n):
if n <= 0:
print('Blastoff!')
else:
print(n)
countdown(n-1)
Write a new recursive function countup that expects a negative argument and counts “up” from that number. Output from running the function should look something like this:
>>> countup(-3)
-3
-2
-1
Describe the difference between a chained conditional and a nested conditional. Give an example of each.
Deeply nested conditionals can become difficult to read. Describe a strategy for avoiding nested conditionals. Give a example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional.
QUESTION 7
(20 marks)
A savings and loan association has decided to undertake the development of an in-house computer system to
replace the processing it currently purchases from a time-sharing bureau. The internal auditors have suggested
that the system development process be planned in accordance with the Systems Development Life Cycle. The
following items have been identified as major systems development activities that will have to be undertaken
I.System test
II.Initial investigation
III.Install hardware and software
IV.Implementation planning
V.Conversion
VI.System survey
VII.Technical specifications
VIII.Systems modification
IX.User procedures and training
X.Programming
Required:
a)Arrange the above ten items in the sequence in which they should logically occur. (10 marks)
b)Discuss the conceptual systems design process in the SDLC and the activities in this phase.
#include <iostream>
using namespace std;
class A {
protected:
char i;
public:
A(char a): i(a) {}
void display(char x){
cout << x << " ";
}
// create abstract function fun()
______________________;
};
class B: ________ {
public:
B(int a = 0): A(a) {}
void fun(){ display(i+1); }
};
class C: ________ {
public:
C(int a = 0): A(a) {}
void fun(){ display(i+2); }
};
class D: ________ {
Explain the difference between a MAC address and an IP address. You should relate your answer to the OSI model
Create a class named Customer that will determine the monthly repayment amount due by a customer for a product bought on credit. The class has five fields: customer name, contact number, product price, number of months and the monthly repayment amount. Write get and set methods for each field, except for the monthly repayment amount field. The set methods must prompt the user to enter the values for the following fields: customer name, contact number, product price and number of months. This class also needs a method to calculate the monthly repayment amount (product price divided by the number of months).
Write the following generic method using selection sort and a comparator: public static <E> void selectionSort(E[] list, Comparator<? super E> comparator) Write a test program that creates an array of 10 GeomtricObjects and invokes this method using GeometricObjectComparator introduced in Listing 20.5 to sort the elements. Display the sorted elements. Use the following statement to create the array: GeometricObjectfi list1 = {new Circle(5), new Rectangle(4, 5), new Circle(5.5), new Rectangle(2.4, 5),
new Circle(0.5), new Rectangle(4, 65), new Circle(5.4), new
rectangle(6.6,1),
new Circle(5.6), new rectangle(5, 4); Also in the same program, write the code that stores six strings by their last character. Use the follwing statement to create the array: String 0 list2 = {"red", "blue", "green", "orange", "yellow", "pink")
#1 Food Plate #1(wings)$18
#2 Food Plate #2 (chicken strips)12
#3 Food Plate #3 (fish basket)12
#4 Food Plate #4 (shrimp po boy)15
#5 Food Plate #5 (pork chop basket)12
Write a program to ask customers to enter their first name and the menu item # they wish to purchase. The program should define a function to assign the price to the food item based on what the customer purchases. Call the function in the program to determine the cost of the food plate. for this program customers will only purchase one food plate. Then ask the customer if they would like to add a tip and how much. Add tax of 9% to the cost of the food item, add in the tip amount and display their total bill. Do not include the tip when you calculate tax. The tip is extra after tax is charged on the food. Be sure to display a $ when displaying the total and 2 decimal
write a python program to count the number of uppercase and lowercase letters in the given word.