Desk check the algorithm given below.
Q: 2. Party shop sells birthday gift bags in two ways. set of 12 bags for $17.99 or an individual bag…
A: {"generalGuidance":{"sections":[{"sectionId":"70279332-1f4d-4559-86be-262a273bbde8","title":"","text…
Q: compare loans with various interest rates) Write a programthat lets the user enter the loan amount…
A: By given problem, it is to be desired to display the user different loan amounts according to the…
Q: Complete the following program that finds which of the time points comes last. The time is expressea…
A: correct statements are: time1="12:00"time2="00:55"hh1,mm1 = time1.split(":")hh2,mm2 =…
Q: include int main() { int M; printf("Enter the number of chairs you want to…
A: As your question , i run the code i got two issue in the given code:…
Q: I cant get it right. Modify the BarChart program from Chapter 6 Exercise 13 to accept the number…
A: Algorithm: Start Read points scored by each player in a season Divide the points of each player by…
Q: A positive whole number n > 2 is prime if no number between 2 and n (inclusive) evenly divides n…
A: Python program: from math import sqrt def prime(n): divisor = 2 found = False…
Q: After all loan information is input, the program should output the loans in the following format:…
A: Note: Programming language is not mentioned so I am doing in C++ In this question, we are asked to…
Q: Modify the BarChart program from Chapter 6 Exercise 13 to accept the number of points scored by each…
A: Given: Modify the BarChart program from Chapter 6 Exercise 13 to accept the number of points scored…
Q: Drag and drop to complete the following flowchart to .find the largest number X among N numbers…
A: Flowchart is the pictorial representation of an algorithm. Since I was supposed to use the given…
Q: 1. Write a program to find the square of two numbers 10, -4. 2. Write a program to find the square…
A: 1. Sample Response: #Python3 program#function to print teh square of 10 and -4def printSquare():…
Q: Write a program that implements the algorithm that you designed in Exercise 34 of this chapter…
A: EXPLANATION: - The required double variables billingAmount, paymentAmount, and credit varibles are…
Q: Expression for calories burned during workout The following equations estimate the calories burned…
A: #Code in Python Input :age (years)weight (pounds)heart rate (beats per minute)time (minutes) Output…
Q: To find the total marks of a student in an assignment, we need to get the proposal marks, Task 2,…
A: Here I am providing the code and the output for the given problem
Q: 3.5 LAB: Exact change Write a program with total change amount as an integer input, and output the…
A: Here I am using Java language to solve this question. Java Code: import java.util.*; public class…
Q: def is_even (number) : return number % 2 == 0 def is_adult (age): return age >= 18 After these…
A: The given code: john = 19 terry = 18 def is_even (number): return number % 2 def is_adult (age):…
Q: Consider records of employees each consists of employee's first name (string), number of hours…
A: I give the code in python along with output and code screenshot
Q: The following is a valid variable's name (select all that apply) A) int B) 5 U C) 245variable D)…
A: As per the given question,we need to select only the valid variable names. For a variable name,there…
Q: odify the guessing-game program so that the user thinks of a number that the computer must guess.…
A: Given: odify the guessing-game program so that the user thinks of a number that the computer must…
Q: Given a positive integer n, the following rules will always create a sequence that ends with 1,…
A: 1)Read the n value using int(input()) function 2)print n value 3)repeat while until n!=1 4)…
Q: /*A program that calculates the tax due or the refund*/ int main () double inc, tax; int n; printf…
A: The explanation of the code is given below:
Q: Given a positive integer n, the following rules will always create a sequence that ends with 1,…
A: As per the requirement program is developed. Note: Here in the question programming language is not…
Q: Q3) Write a program that converts the weather from Celsius to Fahrenheit in a specific day. The…
A: Program Code:
Q: Example 6: Write an algorithm and draw a flowchart to a) read an employee name (NAME), overtime…
A: Define header file <iostream> for input output operations. Define header file <string.h>…
Q: 10 نقاط Trace the following program showing the values of i, j, and z ?at each step void main() {…
A: Step1: i=0 j=0 j<=4 z=z+(i*j)=0 j++ => j=1 z=0 j++ => j=2 z=0 j++ => j=3 z=0 j++ =>…
Q: 1. A software company sells a package that retails for $99. Quantity discounts are given according…
A: logic:- take quantity as user input. apply if else to find out discount. at last subtract…
Q: A. Sum of Others: Write a program called sum_of_others.py Given three numbers x, y, z, determine if…
A: Steps in program: Take x, y, z as input Check using if-elif-else statement whether any two are sum…
Q: (Converting Fahrenheit to Celsius) Write a program that converts integer Fahrenheit temperatures…
A: Since the programming language is not mentioned, I have coded this using C language.
Q: Given a positive integer n, the following rules will always create a sequence that ends with 1,…
A: Algorithm: 1. input a number 2.Condition checking that is number must be greater than 1 3.number is…
Q: Complete a program for counting digits and displaying their total count at the end of the program }
A: Complete code: #include <iostream>using namespace std;int main(){int n;int digits = 0;cin…
Q: ifelseC++ä Exercise 5. Write a program that will calculate the price for a quantity entered from the…
A: #include <stdio.h> int main(void) { int quantity = 0; int price = 5; double total =…
Q: Given a positive integer n, the following rules will always create a sequence that ends with 1,…
A: for whitespaces of \t use end=‘\t’ , but if you don’t want these whitespaces , you can use end=‘ ’
Q: 7- Write a program to input number of 3 digits and check whether it is Armstrong Number or Not.…
A: Write a program to input number of 3 digits and check whether it is Armstrong or not. * Your not…
Q: Q1\Write a program that sums the numbers between 1 and 9 and finds the sum total
A: Here language is not mentioned so i write c code to sum between 1 to 9: (2+3+4+5+6+7+8)…
Q: Question 4: Write an algorithm that asks the user to enter an integer number then prints the sum of…
A: Simple Algorithm to find sum of all digits of a number: Step 1: Get number by user Step 2: Get the…
Q: “Days into the year algorithm (C++)” Write a pseudo code for an algorithm to determine the number of…
A: Objective: Pseudocode needs to be written to input a date in the format YYYY-MM-DD and displays the…
Q: Complete the following program that finds which of the time points comes first. The time is…
A: (1 ) in if condition it will print that time1 comes first means hours of time1 must be less then…
Q: // This program gets student names continuously until XXX is entered. Then, for each student, quiz…
A: All the return boxes should be connected under one box.
Q: a. Write a program that reads your id and full name and display. And also display the index of first…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Read id and name…
Q: UTAS College teacher need to enter 75 marks of students and find out the following • Find out the…
A: program: //importing essential java package import java.util.Arrays; //import Scanner class…
Q: Q4. Write an algorithm and draw a flow chart to get cgpa of student. If CGPA is more than equal to…
A: Algorithm: Step 1: StartStep 2: Read the CGPAStep 3: if CGPA >= 2.7 then go to step 4 . else go…
Q: Q2) Write a program to calculate the average of the semester. To find the average of the semester,…
A: import java.util.*;public class Main{ public static void main(String[] args) { int a=0,b=0,c,d;…
Q: (Converting a given date to the day number in the year) Write a program that prints the day number…
A: Algorithm: Start Store the number of days of a normal year in a list named regYear and number of…
Q: Example 6: Write an algorithm and draw a flowchart to a) read an employee name (NAME), overtime…
A: Include the header files. Declare the structure with employee details. In the main function, create…
Q: units = int(input(" Please enter Number of Units you Consumed : ")) if(units < 50): amount =…
A: I have tested all the scenario its working fine the code is given below
Q: SUPPLEMENTAL ACTIVITIES 1. Write a parameter and return program that will require the user to enter…
A: Solution: C++ PROGRAM: #include <iostream> using namespace std; // Function header and…
Q: A cloth showroom has announced the following seasonal discounts on purchase of items. Purchase…
A: We use if statement within the switch statement. Algorithm Start. Prompt menu to press 1. for Mill…
Q: Print two f-string statements to display the following according to the rules below: 1) Food…
A: #declare all the given fieldsfood1 = 'Salad'food2 = 'Sandwich'price1=3.6price2=4.99 #print the food…
Q: Lab #05 Exercise Write a program to enter 2 out of 3 angles in a triangle, in degrees. Your program…
A: Please give positive ratings for my efforts. Thanks. PROGRAM a = float(input("Enter the first…
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
Desk check the
- Start
- Declare number variable of type int and initiate it to “0”,
- Print “University of Okara”
- Print “Enter the number of registrants”
- Read number
- Check: if (number <=o), Print “Error”
- Check: else if (number <=7), Print “Total amount is Rs”<<number*100
- Check: else if (number >=8 & number<=14 ) , Print “Total amount is Rs”<<number*75
- Check: else , Print “Total amount is Rs”<<number*50
- End/Exit
Step by step
Solved in 2 steps
- Write an algorithm that computes the Body Mass Index (BMI) given the heights and weights of students. The algorithm should first read the total number of students and then read the height and weight of each student to calculate and print the BMI category A student is considered Underweight if the BMI is less than or equal to 18.5; Normal Weight if between 18.5 and 24.9; Overweight if between 25 and 29.9; and Obese if greater than or equal to 30.For each expression in the left-hand column, indicate its value in the right-hand column. Be sure to list a constant of appropriate type (e.g., 7.0 rather than 7 for a double, Strings in "quotes"). Expression Value (int) 9.0/2 23 % 5 - (16 % 10) 1.5 * 2 - 6 / 4 “1”+1 (2+3)+”Hello”+4+2*3 23456/100%10 “a”+4-2use spark to extract grades from string then calculate the average of all grades java examples: example [0]-> Ahmed 80 example [1]-> Ali 70 example [2]-> Reem 85
- Write this uing java Write a complete version of the Bresenham Midpoint algorithm to handle ALL slope values. slope = 0 slope > 0 slope < 0 slope = 1 slope > 1 swap the rolls of x and y slope < 1 slope = infinity ( needs special test case) Include appropriate tests for ‘special case’ conditions. Insteadof “WritePixel” write to the screen the coordinates of the pixel that would be drawn.AlgorithmI need an answer without plagiarism and please type a paragraph about how did you solve your solution after you solved Also, code answer is not allowedmost_frequent_word() takes a string as the input parameter and returns two values; the word that appears most frequently in that string and the total number of times that word appears in that string. In case of a tie, return the first word that appears in the string. Hint: you can use the unique_words function that you wrote in (4). Sample outputs:>>> data = “chapter one hottest day summer so far drawing close drowsy silence lay over large square houses privet drive cars usually gleaming stood dusty drives lawns once emerald green lay parched yellowing”>>> word = most_frequent_word(data)>>> print(word)('lay', 2)>>> data_2 = "a cat in a hat and a big black bear on a big black rug">>> word = most_frequent_word(data_2)>>> print(word)('a', 4)
- Algorithm Design and Analysis 1. Body wanted to go on a tour but he was confused about what items to bring. In order to show his wealth, he decided to bring the item with the highest value. But the suitcase only holds 5KG left. Body asks your help to choose from the list below. Name Price Weight (kg) A 460 4 B 220 1.5 C 360 3 D 220 1 E 400 3.5 F 480 2.5 G 150 2 2. Use KMP to complete the following string matching! T= ACGTACGTGACGTGTACGATATCACGTACT P= ACGTACTI need to complete the following program code for Countdown.java. This program uses recursion to count down from a user input number. import java.util.Scanner; public class Countdown { public static void main(String[] args) { Scanner in = new Scanner(System.in); // Setting up scanner System.out.print("Enter a number: "); int count = in.nextInt(); in.close(); recursiveCountdown(count); } public static void recursiveCountdown(int count) { // System.out.println("Start recursiveCountdown"); System.out.println(count); if (/* Complete here*/) return; recursiveCountdown(/* Complete here*/); // System.out.println("End recursiveCountdown"); } } Output should be as picture showsThe lab values still require that I have the following string patterns in my lab: .+*isPalindrome\(\"Madam\"\).+* .+*isPalindrome\(\"abBa\"\).+* .+*isPalindrome\(\"22\"\).+* .+*isPalindrome\(\"67876\"\).+* .+*isPalindrome\(\"444244\"\).+* .+*isPalindrome\(\"trYmeuemyRT\"\).+*
- void removeStudent(){System.out.print("\n Enter StudentID to remove: ");long id =sc.nextLong();int pos = searchStudentID(id);if(pos == -1)System.out.println("\n ERROR: No student found having same ID: " + id);elsecourses.remove(pos);} int searchStudentID(long studentID){for(int c = 0; c < students.size(); c++)if(studentID == students.get(c).getId())return c;return -1;} The code is supposed to prompt the user to enter a studentID and if it is in the records then it will be removed, but instead it just prompts me to enter and when i enter the ID, it does not remove the ID (I display the data again after I supposedly removed it but it is still there) and just returns back to the menu. What can I do to correct it?void removeStudent(){System.out.print("\n Enter StudentID to remove: ");long id =sc.nextLong();int pos = searchStudentID(id);if(pos == -1)System.out.println("\n ERROR: No student found having same ID: " + id);elsecourses.remove(pos);} int searchStudentID(long studentID){for(int c = 0; c < students.size(); c++)if(studentID == students.get(c).getId())return c;return -1;} The code is supposed to prompt the user to enter a studentID and if it is in the records then it will be removed, but instead it just prompts me to enter and when i enter the ID, it just exits and goes back to the menu. is there something wrong with my code?dictionaries = [] dictionaries.append({"First":"Bob", "Last":"Jones"}) dictionaries.append({"First":"Harpreet", "Last":"Kaur"}) dictionaries.append({"First":"Mohamad", "Last":"Argani"}) for i in range(0, len(dictionaries)): # Condition that's print the full name when Condition is True if(dictionaries[i]['First']=='Bob')or(dictionaries[i]['Last']=='Kaur'): print(dictionaries[i]['First']+" "+dictionaries[i]['Last']) ********************************** please modify the code to use a while loop instead of a for loop