Code to be written in Python:
Correct answer will get the brainliest!

Uyen decides to write a Python program to count towards the next birthday.
In order to do so, she plans to write a function count_days(start_date, end_date) which takes in the start date and end date in the string format, "dd/mm/yyyy", and returns the number of days between the start date and end date. The start date is included while the end date is not included in the count. Note that leading zeros in start_date and end_date are skipped if there are any (For example, the date 1st January 2017 will be in the format 1/1/2017).

Currently, Uyen has only completed a skeleton of count_days, and a few helper functions, which are provided below.

Your Tasks:

(a) Help Uyen complete the four functions marked with 'TODO'. They are get_day_month_year, less_than_equal, next_date and count_days.

(b) Uyen was quite careless, she didn't check for input data validity. You will also need to help her with this. We only proceed to count days if the dates are valid, and the start date is before or same as the end date.

Assume a valid date is between 1/1/1970 and 31/12/9999. The leap year and valid date check are already provided.
If one of the dates is not valid, throw an exception with a message that has the value: "Not a valid date: " + date, where date is the invalid date.
If the start date is after the end date, throw an exception with a message value: "Start date must be less than or equal end date."

Note: is_leap_year(year) and is_valid(d, m, y) are provided, you can make use of them.

Incomplete code:

def is_leap_year(year):
# DONE: do not need to modify
if year % 4 == 0 and year % 100 != 0:
return True
if year % 400 == 0:
return True
return False

def is_valid(d, m, y):
# DONE: do not need to modify
# d, m, y represents day, month, and year in integer.
if y < 1970 or y > 9999:
return False
if m < 1 or m > 12:
return False
if d < 1 or d > 31:
return False

if m == 4 or m == 6 or m == 9 or m == 11:
if d > 30:
return False

if is_leap_year(y):
if m == 2 and d > 29:
return False
else:
if m == 2 and d > 28:
return False

return True

def get_day_month_year(date):
# TODO: split the date and return a tuple of integer (day, month, year)
d = 1
m = 1
y = 1970
return (d, m, y)

def less_than_equal(start_day, start_mon, start_year, \
end_day, end_mon, end_year):
# TODO: return true if start date is before or same as end date
return False

def next_date(d, m, y):
# TODO: get the next date from the current date (d, m, y)
# return a tuple of integer (day, month, year).
return (d, m, y)

def count_days(start_date, end_date):
# date is represented as a string in format dd/mm/yyyy
start_day, start_mon, start_year = get_day_month_year(start_date)
end_day, end_mon, end_year = get_day_month_year(end_date)

# TODO: check for data validity here #
# if start date is not valid...
# if end date is not valid...
# if start date > end date...

# lazy - let the computer count from start date to end date
count = 0
while less_than_equal(start_day, start_mon, start_year, end_day, end_mon, end_year):
count = count + 1
start_day, start_mon, start_year = next_date(start_day, start_mon, start_year)

# exclude end date
return count - 1

Test Cases:

test_count_days('1/1/1970', '2/1/1970') 1
test_count_days('1/1/1970', '31/12/1969') Not a valid date: 31/12/1969
test_count_days('1/1/1999', '29/2/1999') Not a valid date: 29/2/1999
test_count_days('14/2/1995', '19/3/2014') 6973
test_count_days('19/3/2014', '19/4/2013') Start date must be less than or equal end date.
get_day_month_year('19/3/2014') (19, 3, 2014)
get_day_month_year('1/1/1999') (1, 1, 1999)
get_day_month_year('12/12/2009') (12, 12, 2009)
less_than_equal(19, 3, 2014, 19, 3, 2014) True
less_than_equal(18, 3, 2014, 19, 3, 2014) True
less_than_equal(20, 3, 2014, 19, 3, 2014) False
less_than_equal(19, 3, 2015, 19, 3, 2014) False
less_than_equal(19, 6, 2014, 19, 3, 2014) False
less_than_equal(18, 12, 2014, 19, 11, 2014) False
less_than_equal(18, 12, 2014, 19, 11, 2015) True
less_than_equal(31, 3, 2018, 29, 4, 2018) True
next_date(1, 1, 2013) (2, 1, 2013)
next_date(28, 2, 2014) (1, 3, 2014)
next_date(28, 2, 2012) (29, 2, 2012)
next_date(29, 2, 2012) (1, 3, 2012)
next_date(30, 4, 2014) (1, 5, 2014)
next_date(31, 5, 2014) (1, 6, 2014)
next_date(31, 12, 2014) (1, 1, 2015)
next_date(30, 5, 2014) (31, 5, 2014)

Answers

Answer 1
PYTHON

To complete the function get_day_month_year(date), we can split the date string using the / character as a delimiter and return a tuple of integers:

def get_day_month_year(date):

day, month, year = date.split('/')

return (int(day), int(month), int(year))

To complete the function less_than_equal(start_day, start_mon, start_year, end_day, end_mon, end_year), we can compare the year, month, and day of the start date to the year, month, and day of the end date and return True if the start date is less than or equal to the end date:

def less_than_equal(start_day, start_mon, start_year, end_day, end_mon, end_year):

if start_year < end_year:

return True

elif start_year == end_year:

if start_mon < end_mon:

return True

elif start_mon == end_mon:

if start_day <= end_day:

return True

return False

To complete the function next_date(d, m, y), we can first increment the day by 1 and check if the resulting date is valid. If it is not valid, we can set the day to 1 and increment the month by 1. We can continue this process until we reach a valid date:

def next_date(d, m, y):

d += 1

while not is_valid(d, m, y):

d = 1

m += 1

if m > 12:

m = 1

y += 1

return (d, m, y)

Finally, to complete the function count_days(start_date, end_date), we can add code to check the validity of the start and end dates, and throw an exception if either of them is not valid or if the start date is after the end date. We can do this by calling the is_valid function and the less_than_equal function:

def count_days(start_date, end_date):

start_day, start_mon, start_year = get_day_month_year(start_date)

end_day, end_mon, end_year = get_day_month_year(end_date)

if not is_valid(start_day, start_mon, start_year):

raise Exception("Not a valid date: " + start_date)

if not is_valid(end_day, end_mon, end_year):

raise Exception("Not a valid date: " + end_date)

if not less_than_equal(start_day, start_mon, start_year, end_day, end_mon, end_year):

raise Exception("Start date must be less than or equal end date.")

count = 0

while less_than_equal(start_day, start_mon, start_year, end_day, end_mon, end_year):

count = count + 1

start_day, start_mon, start_year = next_date(start_

Hope This Helps You!


Related Questions

Assume your sketch has a variable named silo, which stores an object that is defined by a class you have created. The name of the class is Cylinder. The Cylinder class has a method named volume, which calculates the volume of a cylinder using its property values and returns the calculated value. Which line of code is the correct line to use the silo variable, calculate volume, and store that value in a new variable.

a. let v = [silo volume];
b. let v = volume(silo);
c. let v = silo.volume();
d. let v = silo[volume];
e. let v = cylinder.volume(radius, height);

Answers

Answer:

c. let v = silo.volume();

Explanation:

When you create and initialize a new object you pass through that object's class constructor. The constructor is in charge of initializing all the necessary variables for that class including radius and height. Once you save the object in a specific variable (silo) you need to call the class methods through that variable, using the '.' command. Therefore, in this scenario, in order to call the volume() method you would need to call it from the silo object and save it to the v variable, using the following statement.

let v = silo.volume();

Modify array elements using other elements.
Write a loop that sets each array element to the sum of itself and the next element, except for the last element which stays the same. Be careful not to index beyond the last element.
Ex: Initial scores: 10, 20, 30, 40
Scores after the loop: 30, 50, 70, 40
The first element is 30 or 10 20, the second element is 50 or 20 30, and the third element is 70 or 30 40. The last element remains the same.
1 include ciostream
2 using namespace std;
3
4 int maino
5 const int SCORES SIZE - 4;
6 int bonus Scores[SCORES SIZE);
7 int i;
8
9 for (i = 0; i 10 cin >> bonus Scores[i];
11 >
12
13 /Your solution goes here
14
15 for (1-; i < SCORES.SIZE; ++) {
16 cout << bonus Scores[1] << " ";
17
18 cout << endl;

Answers

Answer:

Complete the code using:

   for (i = 0; i <SCORES_SIZE-1; i++) {

       bonus_Scores[i] = bonus_Scores[i] + bonus_Scores[i+1];

   }

Explanation:

This iterates through all elements of the list except the last

   for (i = 0; i <SCORES_SIZE-1; i++) {

This adds the current element to the next, the result is saved in the current list element

       bonus_Scores[i] = bonus_Scores[i] + bonus_Scores[i+1];

   }

See attachment for complete code

Can you incorporate open-source code from a github forum into IP tool?

Answers

Answer:

No

Explanation:

Answer: No, Info does not allow the use of open-source components in proprietary software he contracts.

Next, you begin to clean your data. When you check out the column headings in your data frame you notice that the first column is named Company...Maker.if.known. (Note: The period after known is part of the variable name.) For the sake of clarity and consistency, you decide to rename this column Company (without a period at the end).

Assume the first part of your code chunk is:

flavors_df %>%

What code chunk do you add to change the column name?

Answers

Answer:

You can use the rename function to change the column name. Here is an example code chunk:

flavors_df %>%

rename(Company = Company...Maker.if.known.)

This will rename the Company...Maker.if.known. column to Company. Note that the old column name is surrounded by backticks () because it contains a period, which is a special character in R. The new column name, Company`, does not need to be surrounded by backticks because it does not contain any special characters.

Explanation:

Html is an improved version of________

Answers

Answer: SGML

STANDARD GENERALISED MARKUP LANGUAGE

Please mark as brainliest if answer is right

Have a great day, be safe and healthy  

Thank u  

XD  

Answer:

Hey mate.....

Explanation:

This is ur answer......

HTML is an improved version of SGML!

Hope it helps!

Brainliest pls!

Follow me! :)

protocol layering can be found in many aspect of our lives such as air travelling .imagine you make a round trip to spend some time on vacation at a resort .you need to go through some processes at your city airport before flying .you also need to go through some processes when you arrive at resort airport .show the protocol layering for round trip using some layers such as baggage checking/claiming,boarding/unboard,takeoff/landing.​

Answers

Answer:

Baggage checking/claiming:

Check in at the city airport and check your baggage

Claim your baggage at the resort airport


Boarding/unboarding:

Board the plane at the city airport

Unboard the plane at the resort airport


Takeoff/landing:

Takeoff from the city airport

Land at the resort airport

Takeoff from the resort airport

Land at the city airport

HELP PLZZ WILL MARK BRAINLIEST

Answers

Answer:

true

value

it conveys your knowledge........

true

true

Explanation:

I also answered your other question too.

Sorry im late

Brainliest??

What is the output of the following code segment?

String[] cs = "Bill Gates and Paul Allen founded Microsoft on April 4, 1975.".split(" ");

System.out.println(cs[6].charAt(5));

Answers

Answer:

o

Explanation:

Need to use Python to create the below function;
''' This function takes as input two lists of same length. It outputs net correlation value between these two lists. To compute correlation between two lists:
1. Compute the average of each list
2. Subtract a list's average from every element in the list (repeat for both lists)
3. Multiply corresponding differences from each list to compute the element-wise correlation
4. Sum all the values from step 3 to compute the net correlation value
Example: [-10,0,10,20],[20,10,10,20] -> 0
def compute_net_correlation(self,data_series_1,data_series_2):
''' #### FILL IN CODE HERE ####
net_correlation = # fill in computation
return net_correlation

Answers

Answer:

The function is as follows:

def compute_net_correlation(data_series_1,data_series_2):

   series1 = 0; series2 = 0

   for i in range(len(data_series_1)):

       series1+=data_series_1[i]

       series2+=data_series_2[i]

   avg_series1 =series1/len(data_series_1)

   avg_series2 =series2/len(data_series_1)

   for i in range(len(data_series_1)):

       data_series_1[i]-=avg_series1

       data_series_2[i]-=avg_series2

       data_series_1[i]*=data_series_2[i]

   net_correlation = 0

   for i in range(len(data_series_1)):

       net_correlation +=data_series_1[i]

   return net_correlation

Explanation:

This defines the function

def compute_net_correlation(data_series_1,data_series_2):

This initializes the sum of each series to 0

   series1 = 0; series2 = 0

This iterates through each data series

   for i in range(len(data_series_1)):

This adds series 1

       series1+=data_series_1[i]

This adds series s

       series2+=data_series_2[i]

This calculates the average of data series 1

   avg_series1 =series1/len(data_series_1)

This calculates the average of data series 2

   avg_series2 =series2/len(data_series_1)

This iterates through each data series

   for i in range(len(data_series_1)):

This subtracts the average from series 1

       data_series_1[i]-=avg_series1

This subtracts the average from series 2

       data_series_2[i]-=avg_series2

This multiplies the corresponding elements of both series

       data_series_1[i]*=data_series_2[i]

This initializes the net correlation to 0

   net_correlation = 0

This iterates through each data series

   for i in range(len(data_series_1)):

This adds up the corresponding elements of both series

       net_correlation +=data_series_1[i]

This returns the net correlation

   return net_correlation

write flow chart pseudocode and algorithm for a computation that perform balance,interest, withdrawal,in bank for Ethiopia?​

Answers

Answer:

Flowchart:

Start

Input customer information (name, account number, etc.)

Calculate balance

Calculate interest

Prompt user to enter withdrawal amount

Calculate new balance

Print new balance

End

Pseudocode:

START

// Declare variables

DECLARE customerName

DECLARE customerAccountNumber

DECLARE customerBalance

DECLARE customerInterest

DECLARE withdrawalAmount

// Get customer information

INPUT customerName

INPUT customerAccountNumber

// Calculate balance

SET customerBalance = customerAccountNumber * customerInterest

// Calculate interest

SET customerInterest = customerBalance * 0.05

// Prompt user to enter withdrawal amount

INPUT withdrawalAmount

// Calculate new balance

SET customerBalance = customerBalance - withdrawalAmount

// Print new balance

PRINT customerBalance

END

Explanation:

Explain in detail the most important technology term outlined

Answers

Answer:

Technology can be most broadly defined as the entities, both material and immaterial, created by the application of mental and physical effort in order to achieve some value. In this usage, technology refers to tools and machines that may be used to solve real-world problems.

Hope it help!:)

Technology is the use of science and engineering in making life easy.

Answer :

Technology

It is defined as the application of the technical knowledge and scientific knowledge which helps in doing certain processes and studies.

Technology is used in practical purposes using the applied sciences or engineering.

Technology is used in the field of engineering, industries, medicals, space and in many more applications.

Learn More :

https://brainly.com/question/4291549

Alvin has designed a storyboard using the following technique. Which storyboard technique did he use?

A.
hierarchical
B.
linear
C.
webbed
D.
wheel

50 Points <3

Answers

Answer:

D. Wheel storyboard

Explanation:

The wheel method is like spokes connected to a main hub.

Question 2
1 pts
Which of the following is true about main and secondary memory?
O Main memory is short term memory used by the CPU in processing commands,
secondary memory is more permanent and used for storage.
Secondary memory is lost when the device's power is turned off.
Main memory is more permanent and used for storage, secondary memory is short
term memory is used by the CPU in processing commands.
Main memory is used for storage.

Answers

Answer:

Main memory is short term memory used by the CPU in processing commands,

secondary memory is more permanent and used for storage.

Explanation:

Main memory defines ur ram.

Secondary memory defines your hard drives etc.

A memory hierarchy is composed of an upper level and a lower level. Assume a CPU with 1ns clock cycle time. Data is requested by the processor. 8 out of 10 requests find the data in the upper level and return the data in 0.3ns. The remaining requests require 0.7 ns to return the data. Determine the corresponding values for the upper level memory.
Hit rate =
Miss rate =
Hit time =
Miss penalty =
AMAT =

Answers

Answer:

Hit rate = 80%

Miss rate = 20%

Hit time = 0.3 ns  

Miss penalty = 0.4 ns

AMAT ≈ 3.875 ns

Explanation:

8 out of 10 = 0.3ns. to return data  ( also finds data in the upper level )

2 out of 10 = 0.7 ns to return data

a) Hit rate in upper level memory

= 8/10 * 100 = 80%

b) Miss rate

= 2/ 10 * 100 = 20%

c) Hit time in the upper level memory

Hit time = 0.3 ns

d) Miss penalty

This is the time taken by the missed requests to return their own data

= 0.7 ns -  0.3 ns =  0.4 ns

e) AMAT ( average memory access time )

Hit rate = 80% , Hit time = 0.3ns

miss rate = 20%  Miss time = 0.7 ns

hence AMAT = (0.3 / 0.8 ) +  (0.7 / 0.2 )

                      ≈ 3.875 ns

An airline describes airfare as follows. A normal ticket's base cost is $300. Persons aged 60 or over have a base cost of $290. Children 2 or under have $0 base cost. A carry-on bag costs $10. A first checked bag is free, second is $25, and each additional is $50. Given inputs of age, carry-on (0 or 1), and checked bags (0 or greater), compute the total airfare. Hints: First use an if-else statements to assign airFare with the base cost Use another if statement to update airFare for a carryOn Finally, use another if-else statement to update airFare for checked bags Think carefully about what expression correctly calculates checked bag cost when bags are 3 or more

Answers

Answer:

The program in Python is as follows:

age = int(input("Age: "))

carryOn = int(input("Carry on Bags [0 or 1]: "))

checkedBags = int(input("Checked Bags [0 or greater]: "))

airFare = 300

if age >= 60:

   airFare = 290

elif age <= 2:

   airFare = 0

if carryOn ==  1:

   airFare += 10

if checkedBags ==  2:

   airFare += 25

elif checkedBags >  2:

   airFare += 25 + 50 * (checkedBags - 2)

print("Airfare: ",airFare)

Explanation:

This gets input for age

age = int(input("Age: "))

This gets input for carry on bags

carryOn = int(input("Carry on Bags [0 or 1]: "))

This gets input for checked bags

checkedBags = int(input("Checked Bags [0 or greater]: "))

This initializes the base cost to 300

airFare = 300

This updates the base cost to 290 for adults 60 years or older

if age >= 60:

   airFare = 290

This updates the base cost to 0 for children 2 years or younger

elif age <= 2:

   airFare = 0

This updates the airFare if carryOn bag is 1

if carryOn ==  1:

   airFare += 10

if carryOn bag is 0, the airFare remains unchanged

This updates the airFare if checkedBags is 2. The first bag is free; so, only the second is charged

if checkedBags ==  2:

   airFare += 25

This updates the airFare if checkedBags greater than 2. The first bag is free; so, only the second and other bags is charged

elif checkedBags >  2:

   airFare += 25 + 50 * (checkedBags - 2)

if checkedBags is 0 or 1, the airFare remains unchanged

This prints the calculated airFare

print("Airfare: ",airFare)

ram play volleyball
simple past​

Answers

Ram played volleyball.

here's your answer..

explain the fundamental Components of a Programming Language
can u answer in 8 lines

Answers

Answer:

1. Syntax: Syntax is the structure of a programming language which includes rules for constructing valid statements and expressions.

2. Data Types: Data types are used to define the type of data that is stored in a variable.

3. Variables: Variables are used to store data values.

4. Operators: Operators are used to perform operations on variables and values.

5. Control Structures: Control structures are used to control the flow of a program.

6. Functions: Functions are used to group related code into a reusable block.

7. Libraries: Libraries are collections of functions and data structures that can be used in a program.

8. Comments: Comments are used to document code and make it easier to understand.

Explanation:

Write a recursive function

string reverse(string str)
that computes the reverse of a string. For example, reverse("flow") should return "wolf". Hint: Reverse the substring starting at the second character, then add the first character at the end. For example, to reverse "flow", first reverse "low" to "wol", then add the "f" at the end.

Answers

Answer:

Explanation:

The following code is written in Java. It creates a function called stringReverse that takes in one string parameter and uses a recursive algorithm to print out the input string in reverse. The output can be seen in the attached picture below.

void stringReverse(String str)

   {

       //Check to see if String is only one character or less

       if ((str==null) || (str.length() <= 1))

           System.out.println(str);

       else

       {

           System.out.print(str.charAt(str.length()-1));

           stringReverse(str.substring(0,str.length()-1));

       }

   }

Shortcuts will help you complete spreadsheet tasks more efficiently. Select each of the following that is a shortcut.

Answers

Answer:

https://quiz let.com/331278088/excel-exam-1-flash-cards/

Explanation:

delete the space in quizlet

BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST

Answers

Answer:

I think the answer is network

hope this helps

have a good day :)

Explanation:

Answer:

Network

Explanation:

What are examples of the major macro actions? Check all that apply.
A) create new records
B) open and close forms
C) open database objects
D) lock databases from changes
E) prevent users from viewing data
F) navigate through records
G) import and export data

Answers

Answer:

A)create new records

B)open and close forms

C)open database forms

F)navigate through records

G)import and export data

Explanation:

Correct on Edge

At what point is photo editing too much? What is your opinion? Please answer in 5-7 sentences.​

Answers

Answer:

Too much photoshop to the point where you start to resemble Kim Kardashian is way too much. Simple men like me enjoy average women. Like makeup, an absurd amount of photoshop will deter most men as they'll find you shallow and fraudulent. More women should start to flaunt their natural beauty. Natural beauty is always a better indicator than excessive photoshop for a good relationship and partner.

Explanation:

Which option best describes open source software?

a type of software used to bundle products together
a type of software used to sync up to Windows
a type of software that works well with almost all applications and drivers
a type of software that can be freely used and modified

Answers

Answer:

a type of software that can be freely used and modified.

how do you create and Make video games for video game consoles

Answers

Answer:

Step 1: Do Some Research & Conceptualize Your Game. ...

Step 2: Work On A Design Document. ...

Step 3: Decide Whether You Need Software. ...

Step 4: Start Programming. ...

Step 5: Test Your Game & Start Marketing

Answer:

tbh- I don't really know- but just wanted to say- I HOPE YOU HAVE AN AMAZING DAY!

one example of FLAT artwork is tagged image file format which is a common computer what file

Answers

One example of FLAT artwork is the Tagged Image File Format (TIFF). TIFF is a common computer file format used for storing raster images.

What is the image file format about?

It is a flexible format that can support a wide range of color depths and image compression methods. It is often used for high-quality images, such as those used in printing, and is supported by a wide range of image-editing software.

Therefore, based on the context of the above, TIFF files are FLAT artwork as they are a single, static image without any animations or interactivity.

Learn more about image file format  from

https://brainly.com/question/17913984

#SPJ1

The method of presentation refers to the planning process for the presentation. the information chosen for the presentation. how the presentation topic will be introduced. how the presentation will be delivered.

Answers

Yes, the method of presentation refers to the planning process for the presentation, the information chosen for the presentation, how the presentation topic will be introduced, and how the presentation will be delivered. It encompasses all aspects of creating and delivering a presentation, including the organization and structure of the information, the visual aids that will be used, and the delivery style and techniques of the presenter.

The planning process includes determining the purpose and goals of the presentation, as well as identifying the target audience and the specific information that will be most relevant and engaging to them.

The information chosen for the presentation should be relevant to the topic and purpose, it should be concise, accurate, and should be supportive of the overall message of the presentation.

The introduction should be clear and concise, it should grab the attention of the audience, and it should provide a preview of the key points that will be covered in the presentation.

The delivery of the presentation can include the use of visual aids, such as slides, videos, images, and handouts, and the presenter should be prepared to speak confidently and to answer questions from the audience. Additionally, the presenter should try to adapt to their audience and the environment of the presentation.

Grade Average Lab Assignment Purpose: The goal of this lab assignment is to learn how to use for loops and if/else commands. Write a program that will calculate a numeric average and a letter grade for a student. The main method creates an object of the Grades class that sends two parameters to the Grade class constructor: a student name and the grades to be averaged.

Answers

Answer:

//class to test the Grade class

public class GradeTest{

    public static void main(String []args){        

       //create the grades to be averaged

      double [] grades = {23, 45, 67, 12.6};

       

       //create an object of the Grade class and

       //pass in the necessary arguments to the constructor

       Grade grade = new Grade("John", grades);

       

       //print out the results from the Grade object.

       System.out.println("Your name is " + grade.getName());

       System.out.println("Your average score is " + grade.getAverage());

       System.out.println("Your letter grade is " + grade.getLetterGrade());

       

   }

}  //End of the GradeTest class

//The Grade class

class Grade {

   

   //create instance variables

   private String name;

   private double [] grades;

   

   //constructor for the class

  public Grade(String name, double [] grades){

       

       //initialize the instance variables

      this.name = name;

       this.grades = grades;

       

   }

   

   //method to return the name of the student

  public String getName(){

       //return the name

       return this.name;

   }

   

   

   //method to calculate the average of the grades

  public double getAverage(){

       

       double [] grades = this.grades;

       

       //initialize some needed variables

       double sum = 0;

       double average = 0;

       

       //loop through the grades array and add each element to the sum variable

       for(int i =0; i < grades.length; i++){

           sum += grades[0];    

       }

       

       //calculate the average

      average = sum / grades.length;

       

       //return the average grade

       return average;

     

   }

   

   

   //method the calculate the letter grade from the average

   public char getLetterGrade(){

       

       //initialize some variables

      double average = this.getAverage();

       char letterGrade;

       

       //check the average and determine its corresponding letter grade

       if(average >= 40 && average < 45){

           letterGrade = 'E';

       }

       else if(average >= 45 && average < 50){

           letterGrade = 'D';

       }

       else if(average >= 50 && average < 60){

           letterGrade = 'C';

       }

       else if(average >= 60 && average < 70){

           letterGrade = 'B';

       }

       else if(average >= 70 && average <= 100){

           letterGrade = 'A';

       }

       else {

           letterGrade = 'F';

       }

       //return the letter grade

       return letterGrade;

       

   }

   

}   //End of the Grade class

Sample Output:

Your name is John

Your average score is 23.0

Your letter grade is F

Explanation:

The code above is written in Java and it contains comments explaining important parts of the code. It also contains a sample output got from running the program. To run this on your machine, copy the code and save in a file named GradeTest.java

Write a function that simulates the roll of a six-sided dice. The name of the function is rollDice. The function accepts no parameters and returns a pseudorandom int: 1, 2, 3, 4, 5, or 6. Write only the function, not the main program. You may assume that srand() was invoked in the main function. There should not be any cin or cout statements in the function.

Answers

Answer:

int rollDice(){

  return 1 + rand() % 6;

}

Explanation:

What did the police threaten to do?

Answers

Answer:

fire?

Explanation:

Can someone write an essay on data storage and describe the different storages I have listed below•
Hard drive disk
floppy disk
tape
compact disk
dvd and blu-ray
usb flash drive
secure digital card
solid state drive
cloud storage
punch card
...
.
.
. This is worth 100 points!!!
I really need this!

Answers

Answer:

Explanation:

Punch card is the oldest computer storage; followed by tape and then floppy disk. Hard drive goes back as far as floppy but is still in use today. CD/DVD/BR discs are all later storage but are also used for storing music and videos. USB flash, SD card, SSD and cloud storage are the common technologies used today for data storage.

Answer:

Explanation:

the other answer talks about when the different storages were used; here are their capacity comparison; in increasing order:

punch card - one hole represents 1 bit

tape - slightly more w/ 0/1 represented by sound

floppy disk - more as 0/1 represented by magnetics

hard drive - also magnetics but capacity ranges from okay (in MB) at the beginning to enormous (in TB) currently

CD - beginning to be okay but still under 1 GB

DVD and BR - better 5-28GB

USB/SD/SSD - good; all in 10s to 100s of GB

cloud storage - UNLIMITED!

Other Questions
What is the value of 2 by 7 and 3 by 7? Seaside Bike Shop rents bikes for $10 plus 54 per hour. Jack paid $30 to rent a bike. Which equation, when solved for x, gives thenumber of hours he rented the bike? How do the seventh grade girls in New York City feel about going to the dance? Martin flips a standard coin three times, what is the probability it lands on tails all three times? Find the area of this circle. Use 3.14 for pie . 100 POINTS, Which belief did Thomas Jefferson have? A strong national government is necessary to prevent internal rebellions. Tariffs should protect American manufacturing. A national bank will strengthen the nation. There should be a clear separation of church and state. what will the boiling point of CHCL3 be when the atmospheric pressure exerted on its surface is 101.325 Solve the following equations for . Check for extraneous solutions. Exercise 24.28For the capacitor network shown in (Figure 1), the potential difference across ab is 48 V.Part AFind the total charge stored in this network.Express your answer with the appropriate units.Q = ___ ____Part BFind the charge on the 150nF capacitor.Express your answer with the appropriate units.Q = 7.2uCPart CFind the charge on the120nF capacitor.Express your answer with the appropriate units.Q = 5.76 uCPart DFind the total energy stored in the network.Express your answer with the appropriate units.U = ____ ____Part EFind the energy stored in the 150nF capacitor.Express your answer with the appropriate units.U = ______Part FFind the energy stored in the 120nF capacitor.Express your answer with the appropriate units.U= _____Part GFind the potential difference across the 150nF capacitor.Express your answer with the appropriate units.V= ____Part HFind the potential difference across the 150nF capacitor.Express your answer with the appropriate units.V = ____ help please I need help as soon as possible Explain if this student has made a mistake. Explain what the mistake was and how you would fix it. include the right answer A bag contains 27 balls. The ratio of red to blue to yellow balls is 6:1:2 find how many red, blue and yellow balls there are Please enter the missing number: 3, 5, 18, 72, ?A. 144B. 214C. 272D. 360E. 432Please explain precisely Write each adjective so it matches the subject given. Evaluate each numerical expression7x(12+8)-6 Explain the problem of evil in your own words. After considering the free will response, and the soul-making theodicy, do you think there are adequate responses to the problem of evil and suffering? Why or why not? How does the Buddhist respond to the problem of suffering? Ser is used to (select all that apply) Identify at least two physical properties (streak, fracture, etc.) of a mineral while using examples of common minerals that prominently feature those properties. Provide links or screenshots of the discussed minerals to illustrate the highlighted properties. Also, explain what mineral group it belongs to and why. What volume of 0.75 M HSO4 is required to neutralize 25.0mL of 0.427 M KOH? Write 28 in simplest radical form.