HIERARCHICAL EXAMPLE.
Many examples of hierarchical addressing exists which reduces the amount of work needed in locating or in delivering,and one of such examples is the 'sorting of books in a library'.
Looking at a library having books kept randomly on any stack and shelf,it will make it difficult finding any book easily or locating any book of a specific genre.so,to avoid such problems, books are orderly sorted in a library and each book is given or has a unique identification number.
Books that has the same or related subject are kept in the same stack and books of the same genre are also kept together.
In a library,there are many stacks having different rows.
Take for an example; If one need to find a book on computer network,the user can search for the books in stacks of books that are related to Computer Science instead of searching the whole library for the book.
So,the hierarchical addressing saves lots of work and also time required for searching a specific book in the library.
b. fork
c. break
d. loop
Answer:
Option D is correct.
Explanation:
A Loop statment is a control flow statement that repeatedly executes a statement or a series of statements while the value of a specific condition is truthy or until the value of a specific condition becomes truthy.
calc_average - this function should accept 8 test scores as arguments and return the average of the scores per student
determine_grade - this function should accept a test score average as an argument and return a letter grade for the score based on the following grading scale:
90-100 A
80-89 B
70-79 C
60-69 D
Below 60 F
In this exercise we have to use the computer language knowledge in python to write the code as:
the code is in the attached image.
In a more easy way we have that the code will be:
def calc_average(name):
score = []
sum = 0
for j in range(8):
inp = int(input("Test Score"+str(j+1)+": "))
score.append(inp)
sum = sum + inp
if inp>=90 and inp<=100:
print("A")
elif inp>=80 and inp<90:
print("B")
elif inp>=70 and inp<80:
print("C")
elif inp>=60 and inp<70:
print("D")
else:
print("F")
avg = sum/8
print("Result Details of "+name)
print("Average Score: "+str(avg))
return avg
def determine_grade(result):
if float(result) >= 90.0 and float(result) <= 100.0:
print("Letter Grade: A")
elif float(result) >= 80.0 and float(result) <90.0:
print("Letter Grade: B")
elif float(result) >= 70.0 and float(result) < 80.0:
print("Letter Grade: C")
elif float(result) >= 60.0 and float(result) < 70.0:
print("Letter Grade: D")
else:
print("Letter Grade: F")
print(" ")
for i in range(2):
name = input("Student Name: ")
result = calc_average(name)
determine_grade(result)
See more about python at brainly.com/question/26104476
Answer:
The program doesn't make use of comments (See Explanation)
Also the source code is attached as image to enable you see the proper format and indexing of the source code
The program using python is as follows
def calc_average(name):
score = []
sum = 0
for j in range(8):
inp = int(input("Test Score"+str(j+1)+": "))
score.append(inp)
sum = sum + inp
if inp>=90 and inp<=100:
print("A")
elif inp>=80 and inp<90:
print("B")
elif inp>=70 and inp<80:
print("C")
elif inp>=60 and inp<70:
print("D")
else:
print("F")
avg = sum/8
print("Result Details of "+name)
print("Average Score: "+str(avg))
return avg
def determine_grade(result):
if float(result) >= 90.0 and float(result) <= 100.0:
print("Letter Grade: A")
elif float(result) >= 80.0 and float(result) <90.0:
print("Letter Grade: B")
elif float(result) >= 70.0 and float(result) < 80.0:
print("Letter Grade: C")
elif float(result) >= 60.0 and float(result) < 70.0:
print("Letter Grade: D")
else:
print("Letter Grade: F")
print(" ")
for i in range(2):
name = input("Student Name: ")
result = calc_average(name)
determine_grade(result)
Explanation:
def calc_average(name): -> Declares the function calc_average(name); It accepts local variable name from the main function
score = []
-> Initialize an empty list to hold test scores
sum = 0
-> Initialize sum of scores to 0
for j in range(8):
-> Iterate from test score 1 to 8
inp = int(input("Test Score"+str(j+1)+": "))
-> This line accepts test score from the user
score.append(inp)
-> The user input is then saved in a lisy
sum = sum + inp
-> Add test scores
The following lines determine the letter grade of each test score
if inp>=90 and inp<=100:
print("A")
---
else:
print("F")
avg = sum/8 -> Calculate average of the test score
The next two lines prints the name and average test score of the student
print("Result Details of "+name)
print("Average Score: "+str(avg))
return avg
-> This line returns average to the main method
The following is the determine_grade method; it takes it parameter from the main method and it determines the letter grade depending on the calculated average
def determine_grade(result):
if float(result) >= 90.0 and float(result) <= 100.0:
print("Letter Grade: A")
elif float(result) >= 80.0 and float(result) <90.0:
print("Letter Grade: B")
elif float(result) >= 70.0 and float(result) < 80.0:
print("Letter Grade: C")
elif float(result) >= 60.0 and float(result) < 70.0:
print("Letter Grade: D")
else:
print("Letter Grade: F")
print(" ")
for i in range(2):
-> This is the main method
name = input("Student Name: ") -> A local variable stores name of the student
result = calc_average(name) -> store average of scores in variable results
determine_grade(result)-> Call the determine_grade function
B reformat a hard disk drive
C manage fonts on a computer
D write and edit documents
You use utility software to:
Utility software are known to be a kind of software that is often used to configure and maintain any system.
Conclusively, Note that this software is made up of small programs which can be used to Reformat a hard disk drive and also to Manage fonts on a computer.
Learn more about utility software from
Utility software is system software designed to help analyze, configure, optimize or maintain a computer. Utility software usually focuses on how the computer infrastructure (including the computer hardware, operating system, software and data storage) operates.
Java application:
Java is a programming language and computing platform first released by Sun Microsystems in 1995. It has evolved from humble beginnings to power a large share of today’s digital world, by providing the reliable platform upon which many services and applications are built.
//create a class MathTest.java
public class MathTest {
public static void main(String[] args) {
//a. The square root of 37
System.out.println("The square root of 37= " + Math.sqrt(37));
//b. The sine and cosine of 300
System.out.println("The sine of 300=" + Math.sin(300));
System.out.println("The cosine of 300=" + Math.cos(300));
//c. The value of the floor, ceiling, and round of 22.8
System.out.println("The value of the floor 22.8=" + Math.floor(22.8));
System.out.println("The value of the ceiling 22.8=" + Math.ceil(22.8));
System.out.println("The value of the round 22.8=" + Math.round(22.8));
//d. The larger and the smaller of the character ‘D’ and the integer 71
int number = 'D';
System.out.println("The larger of the character ‘D’ and the integer 71=" + Math.max(number, 71));
System.out.println("The Smaller of the character ‘D’ and the integer 71=" + Math.min(number, 71));
//A random number between 0 and 20
System.out.println("A random number between 0 and 20= "+(int)(Math.random()* 20 + 1));
}
}
Output:
The square root of 37= 6.082762530298219
The sine of 300=-0.9997558399011495
The cosine of 300=-0.022096619278683942
The value of the floor 22.8=22.0
The value of the ceiling 22.8=23.0
The value of the round 22.8=23
The larger of the character ‘D’ and the integer 71=71
The Smaller of the character ‘D’ and the integer 71=68
A random number between 0 and 20= 10
Learn more about the topic Java application:
Answer:
Role of websites in internet
Importance of internet in our daily life
The statement which gives the sum of nickel and dime is written below :
total_coins = nickel_count + dime_count
The statement required is written using Python 3 :
deftotal(nickel_count, dime_count) :
total_coins =dime_count+nickel_count
print(total_coins)
total(100, 200)
#the function total takes in two arguments(number of nickels and number of dimes)
#assigns the varibale total_coins to the sum of nickel_count and dime_count
nickel_count = int(input('Enter count of nickel : '))
# User is prompted to enter number of nickels
dime_count = int(input('Enter count of dime : '))
# User is prompted to enter number of dimes
total_coins = nickel_count + dime_count
#assigns the varibale total_coins to the sum of nickel_count and dime_count
print(total_coins)
#outputs the value of total_coins
Learn more : brainly.com/question/17615351
Answer:
total_coins = nickel_count + dime_count
Explanation:
The statement that performs the operation in the question is total_coins = nickel_count + dime_count
Full Program (Written in Python)
nickel_count = int(input("Nickel Count: "))
dime_count = int(input("Dime Count: "))
total_coins = nickel_count + dime_count
print("Total coins: ",total_coins)
The first two lines prompt user for nickel and dime count respectively
The third line adds the two coins categories together
The last line prints the total count of coins