1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
avanturin [10]
3 years ago
6

Suppose there is a class Roster. Roster has one variable, roster, which is a List of tuples containing the names of students and

their number grades--for example, [('Richard', 90), ('Bella', 67), ('Christine', 85), ('Francine', 97)]. Roster has a function findValedictorian that returns the name of the student with the highest grade. Find the valedictorian of the Roster object englishClass and store it in the variable valedictorian.
Computers and Technology
1 answer:
Ahat [919]3 years ago
7 0

Answer:

class Roster:

   def __init__(self,student):

       self.student = student

   def findValedictoian(self):

       

       highscore = 0

       studentList=[]

       bStudent = []

       valedictorian =''

       for pupil in self.student:

           if pupil[1] > highscore:

               highscore = pupil[1]

              valedictorian = pupil[0]

       return valedictorian

   

student = [('rich', 90), ('Bella', 67),('philip', 56)]

englishClass= Roster(student)

print(englishClass.findValedictoian())

Explanation:

we define the roster class using the class keyword, within the class we have our __init__ constructor and we initialize the variable student.

A class method findValedictoian is defined and it compares the grades of each student and returns the name of the student with the highest grade.

An instance is created for English class and the findValedictorian method is called and the valedictorian is printed to the screen.

You might be interested in
Use the drop-down menus to match each description with the part of a report where it is located.
Roman55 [17]

Answer:

1) Detail

2) Report footer

3) Page footer

4) Group Header

5) Report header

6) Group footer

7) Page header

Explanation:

I just did the assignment

4 0
3 years ago
What are some legal issues that can arise from the use of social media?
Andrews [41]

Answer:

Some of the particular legal concerns for businesses' social media are the right to privacy, defamation, advertising law, intellectual property (IP) law, etc. As a brand, you have to be careful while sharing any content on social media as sometimes it may infringe on a copyright, a trademark, or other IP rights

Explanation:

hope this helps

6 0
2 years ago
Write a program that produces a Caesar cipher of a given message string. A Caesar cipher is formed by rotating each letter of a
PilotLPTM [1.2K]

Answer:

Here is the JAVA program that produces Caeser cipher o given message string:

import java.util.Scanner;  //to accept input from user

public class Main {  

   public static void main(String args[]) {  //start of main function

       Scanner input = new Scanner(System.in);  //creates object of Scanner

       System.out.println("Enter the message : ");  //prompts user to enter a plaintext (message)

       String message = input.nextLine();  //reads the input message

       System.out.println("Enter the amount by which by which to rotate each letter : ");  //prompts user to enter value of shift to rotate each character according to shift

       int rotate = input.nextInt();  // reads the amount to rotate from user

       String encoded_m = "";  // to store the cipher text

       char letter;  // to store the character

       for(int i=0; i < message.length();i++)  {  // iterates through the message string until the length of the message string is reached

           letter = message.charAt(i);  // method charAt() returns the character at index i in a message and stores it to letter variable

           if(letter >= 'a' && letter <= 'z')  {  //if letter is between small a and z

            letter = (char) (letter + rotate);  //shift/rotate the letter

            if(letter > 'z') {  //if letter is greater than lower case z

               letter = (char) (letter+'a'-'z'-1); }  // re-rotate to starting position  

            encoded_m = encoded_m + letter;}  //compute the cipher text by adding the letter to the the encoded message

           else if(letter >= 'A' && letter <= 'Z') {  //if letter is between capital A and Z

            letter = (char) (letter + rotate);  //shift letter

            if(letter > 'Z') {  //if letter is greater than upper case Z

                letter = (char) (letter+'A'-'Z'-1);}  // re-rotate to starting position  

            encoded_m = encoded_m + letter;}  //computes encoded message

           else {  

         encoded_m = encoded_m + letter;  } }  //computes encoded message

System.out.println("Encoded message : " + encoded_m.toUpperCase());  }} //displays the cipher text (encoded message) in upper case letters

Explanation:

The program prompts the user to enter a message. This is a plaintext. Next the program prompts the user to enter an amount by which to rotate each letter. This is basically the value of shift. Next the program has a for loop that iterates through each character of the message string. At each iteration it uses charAt() which returns the character of message string at i-th index. This character is checked by if condition which checks if the character/letter is an upper or lowercase letter. Next the statement letter = (char) (letter + rotate);   is used to shift the letter up to the value of rotate and store it in letter variable. This letter is then added to the variable encoded_m. At each iteration the same procedure is repeated. After the loop breaks, the statement     System.out.println("Encoded message : " + encoded_m.toUpperCase()); displays the entire cipher text stored in encoded_m in uppercase letters on the output screen.

The logic of the program is explained here with an example in the attached document.

8 0
4 years ago
What is the encryption cipher that was the precursor to des??
Elanso [62]
DES works by using the same key to encrypt and decrypt a message, so both the sender and the receiver must know and use the same private key. Once the go-to, symmetric-key algorithm for the encryption of electronic data, DES has been superseded by the more secure Advanced Encryption Standard (AES) algorithm.
8 0
3 years ago
at the grocery store alexa by 1 1/3 lb of ground turkey nasha by two times as much ground turkey is alexa how much ground turkey
Alexeev081 [22]
tasha buys 2 2/3 much ground turkey
8 0
3 years ago
Other questions:
  • As you're helping a user configure her e-mail over the phone, she remarks that the IP address is different than it was when she
    6·1 answer
  • What percentage of jobs work in the entertainment industry?
    13·1 answer
  • Provide a few examples of how cryptography actually secures data.
    8·1 answer
  • What is essential to delivering a successful presentation?
    5·2 answers
  • GIVING BRAINLIST TO WHOEVER ANSWERS
    9·1 answer
  • . Which of the following is NOT a valid declaration for a character string?
    6·1 answer
  • What is a computer and what is the work of it​
    5·2 answers
  • A program that doesn’t work properly needs to be debugged. true or false
    8·1 answer
  • 3. In 1989, the first handheld console was released by _____ and it was called ________.
    13·1 answer
  • Help me please I’m failing
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!