I am trying to write a program where it counts from 1 to 1000 with an if statement where after the number 20 it counts evenly. I keep getting an error and I can't find what I need to fix
Q: Write a program that inputs a number and a letter and then decides whether the square is a black or…
A: Required: Write a program that inputs a number and a letter and then decides whether the square is a…
Q: rite a program that uses switch statement to enter the grades A, B, C, D or F. Your program should…
A: Given: Write a program that uses switch statement to enter the grades A, B, C, D or F. Your program…
Q: Explain the difference between the statements on the left and the statements on the right For each…
A: Group 1 has the Switch Case Statements whereas Group 2 has the If else Statements- In Switch Case…
Q: When giving the user a set of choices to choose from, should numbers be used? E.g. 1, 2, 3? If so,…
A: Using numbers such as 1,2,3 to choose a set of choices make it more sense from user point of view.…
Q: You are to write a program to tell you how many months it will take to pay off a loan, as well as…
A: Following is the code for the loan calculator using C++
Q: In this assignment you will write a C++ program that can figure out a number chosen by a human user.…
A: Program: #include <iostream>using namespace std;/*getMidpoint.This function accepts two…
Q: Write a program that reads from the user two integers of three digits each. The program finds the…
A: import java.util.*;public class Main{ // to display the digits of number separated by space public…
Q: Write a program to convert centigrade to Kelvin. It should display value in centigrade and then the…
A: Python program to solve the given problem is below.
Q: > Example: Rewrite the previous code by using nested if condition. grade (x) := if x 2 60 out "you…
A: Here we are taking marks as an input and as a output we get grade of a student if student is less…
Q: You want your program to execute statement 1 when A is false, B is false, and C is true, and to…
A: Justification: “No”, it will not do what the user want because, the condition provided in the “if”…
Q: Write a program that accepts a number entered by the user and validates if it is odd oreven. If it…
A: Sample Response: #python3 program#accept a numbernum = int(input("Enter a number: "))#validate the…
Q: Write program to print "OK" if the number is even and greater than 100 or the number is even and…
A: Conditional statement: A programming language allows to test or check the condition to control the…
Q: A word is called as a good word if all the letters of the word are distinct. That is, all the…
A: Actually, python is a easiest programming language. It has a concise(less) code.
Q: What is the value of x after the following if-else statement is executed? Rewrite it using a switch…
A: Answer: Given if-else statement: int x = 1, a = 3;if ( a == 1 ) x+ = 5 ;else if (a == 2)…
Q: / Write a program (using IF statement) to display the name of day by giving the day number as the…
A: The required Matlab program has been provided, by using if-else statements, in the next step.
Q: Write a program to read a student's score between 10.1, and if the value is between 10.8, type the…
A: Required: Write a c++ program using a switch statement to find a student's grade. Required code…
Q: Implement the following: 1) Request a user input for the variable, direction. 2) Write an…
A:
Q: how do you Write a program that prompts the user to input two POSITIVE numbers — a dividend…
A: PROGRAM STRUCTURE: Include all the required header files. Include iostream for using input output…
Q: Write a program that converts "kilometers per hour" to "miles per hour". miles = (kilometers…
A: Hi. As there is no language mentioned, I will attempt this question using Python. Let's move on…
Q: Write a program that prompts the user to enter the month and first day of the month, and displays…
A: /*program that prompts the user to enter the month and first day of the month, and displays all the…
Q: Write a program to prompt the user for their age. Based on their age print out which generation they…
A: If age>21 and age<36 You are generation millennials. Youth ends at 40, old age begins at 59.…
Q: Take a picture of the input and output Use an if-else statement to write a Matlab program that…
A: The answer is given below.
Q: Write a program in C language by using switch statement for switch light with two buttons that are…
A: Switch case statements are used to replace if...else statements to avoid long statements with…
Q: Exercise • Write a program that asks the user -Do you want to use this program? (y/n) • If the user…
A: Code: #include <iostream> using namespace std; int main(){ string c="y"; int count=1;…
Q: Write a program, which takes an input from the user, if the number is between 90 100, Print A Grade,…
A: Since no programming language is mentioned, I am using python Algorithm: 1. Start 2. Take input…
Q: This program does not throw an error, but when an odd number is input for the variable number, it…
A: Java Program for above : import java.util.Scanner; public class NumbersDemo2 { public…
Q: program that prompts the user to enter an integer. If the number is a multiple of 5, print HiFive.…
A: As programming language is not mentioned, so we are providing answer in C++ language.
Q: Q/ Write a program in Matlab language to read the numbers x, y and to calculate the value of z using…
A: It is a simple case of using if else . Given value of x and y. z=(x+y)(2*x+3*y) when x=2, y=3…
Q: Write a program that prompts the user to enter an integer and determines whether it is divisible by…
A: Since there is no programming language, below is the program in python.
Q: Write an if-else statement with multiple branches. If year is 2101 or later, print "Distant future"…
A: year=int(input()) #taking the inputif(year>=2101): #condition for distant futureprint("Distant…
Q: write a program in C++ using if-else or switch for calculating electricity bill, the range of the…
A: GIVEN: write a program in C++ using if-else or switch for calculating electricity bill, the range…
Q: Write an if statement that checks to see if the value in variable, use the name val, is even or odd.…
A: Given To do python program of odd or even.
Q: Write a C++ program that : You have to do the following question only by nested if-statement. FROM…
A: Write a C++ program that : FROM GRADE A TO F A 93-100% A- 90-92% B+ 87-89% B 83-86% B- 80-82%…
Q: Write a program that accepts an integer number and determines whether the number is "EVEN" or "ODD.…
A: ALGORITHM:- 1. Take input for the number from the user. 2. Check if the number is even, odd or zero.…
Q: (Yes/No): Is it possible for both the Sign and Zero flags to be set at the same time?
A: Justification: No, it is not possible for both the Sign and Zero flags to be set at the same time.…
Q: Write a program that inputs three different integers from the keyboard, then prints the sum, the…
A: here is your code
Q: Write an if-else statement with multiple branches. If year is 2101 or later, print "Distant future"…
A: Here I have taken input from the user and then stored it into a variable Now we need to find that…
Q: Write a program that convert one killometer into miles per hour
A: (C++) #include <bits/stdc++.h>using namespace std; // Function to convert kmph to…
Q: 2. Write a complete program that prompts the user for a test score and prints out the letter score…
A: //2import java.util.Scanner;//to reading input from userpublic class Main{ public static void…
Q: Write a program that reads from the user a character ('s' or 'a'). • If the character is 's', the…
A: As no programming language is mentioned, it is solved using basic C++
Q: Write a program that converts an input inch(es) into its equivalent centimeters.
A: here in this question we have asked to write a program that convert inches to centimeter.
Q: Create C program that loops from 1 to 30 and prints out each value on a separate line, except print…
A: Please give positive ratings for my efforts. Thanks. PROGRAM #include <stdio.h> int main()…
Q: e a program that will read a 4- to 6-digit number and print it wi
A: Required: Write a program that will read a 4- to 6-digit number and print it with a comma c++
Q: Write a program that mimics a calculator. The program should take as input two integers and the…
A: # Program make a simple calculator # This function adds two numbers def add(x, y): return x + y #…
Q: Suppose you want to test for a variable score if its value is equal to 100 and you write this…
A: Given python code statements: if score = 100: print("Score is 100) We have to find a potential…
Q: Write a program that will display the even numbers from 1 to 100.
A: As per our company guidelines, we are supposed to answer only one question per post and kindly…
I am trying to write a
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- This file has syntax and/or logical errors. Determine the problem and fix the program. // Employee's salary should not be negative // Include stack trace when exception occurs using System; using static System.Console; class FDebugEleven03 { static void Main() { Employee emp = new Employee(); try { emp.IdNum = 234; emp.Salary = -12; } catch (NegativeSalaryException e) { WriteLine(e.Message); WriteLine(e.StackTrace); } } } public class NegativeSalaryException : { private static string msg = "Employee salary is negative."; public NegativeSalaryException() : base(msg) { } } public class Employee { private int idNum; private double salary; public int IdNum { get return idNum; set idNum = value; } public double Salary { get {…Program this in java the state and variable display must be:Unsorted Partition Reference Index: 0, Traversing Index: 7, Current Traversing Index Value: mango, Next Index Value: plum, Swapping Condition: FalseCurrent Array: ['apple', 'avocado', 'orange', 'banana', 'strawberry', 'pineapple', 'plum', 'mango'] The input:["apple", "avocado", "orange", "banana", "strawberry", "pineapple", "plum", "mango"]Note:The sorted partition is on the left side. Then, the order is increasing based on the number of vowels of a string.the output must be like this:['plum', 'apple', 'strawberry', 'mango', 'orange', 'banana', 'avocado', 'pineapple']do some changes in code and make it unique #include <stdio.h>#include <stdlib.h>#include<string.h>//declaring functionsvoid firstFit(int [], int , int [],int );void bestFit(int [], int , int [],int );void worstFit(int [], int , int [],int );//starting programint main() {//declare partitions and processint partitions [] = {110, 450, 100, 250, 500};int processes [] = {212, 417, 112, 426};//getting their sizesint size_partitions = sizeof(partitions )/sizeof(partitions [0]);int size_processes = sizeof(processes )/sizeof(processes [0]);printf("Partitions size: ") ;for (int i=0; i<size_partitions; i++){printf("%d\t" ,partitions[i] );}//index partprintf("\nPartitions index: " );for (int i=0; i<size_partitions; i++){printf("%d\t" ,(i+1)) ;}printf( "\n" );// calling functionsfirstFit(partitions , size_partitions, processes , size_processes);bestFit(partitions , size_partitions, processes , size_processes);worstFit(partitions , size_partitions, processes ,…
- Problem Given the target file f0 and candidate files f1-f20, there is an identical copy of f0 among the files f1-f20. Write a python program to perform the following tasks: · Read in each file and calculate the hex hash values by using SHA3 function with the length of 512 for all the given files f0, f1-f20. · Save the hex hash values of each file as a new line in a .txt file named hash.txt file. · Read hash values from hash.txt and compare them to find the identical copy of f0 among f1-f20. · Write the finding result (the matched file name) back to hash.txt Submission • Name your project fileHash.py and submit both fileHash.py and hash.txt on Blackboard. • The program should be properly documented. • The program should have user friendly Input/Output design • Duplicate work (or obviously similar one) will result in an F grade in the course. Grading 1. Include comments as specified in the course syllabus. (10%) 2. Source code and results. · Correctness (70%) · User-friendliness…void writeEmpToFile(Employee *emp, FILE *f) { fwrite(&emp->salary, sizeof(emp->salary), 1, f); fwrite(&emp->yearBorn, sizeof(emp->yearBorn), 1, f); fwrite(emp->ssn, sizeof(char), SSN_SIZE, f); int len = strlen(emp->name) + 1; fwrite(&len, sizeof(int), 1, f); fwrite(emp->name, sizeof(char), len, f); } If you don't want to look at all the code then please help me get the other section done from this code that I will put right here directly in the post if you need context on what this code needs to work with you can click on the link below https://onlinegdb.com/nWSAIx8hCnvoid writeEmpToFile(Employee *emp, FILE *f) { fwrite(&emp->salary, sizeof(emp->salary), 1, f); fwrite(&emp->yearBorn, sizeof(emp->yearBorn), 1, f); fwrite(emp->ssn, sizeof(char), SSN_SIZE, f); int len = strlen(emp->name) + 1; fwrite(&len, sizeof(int), 1, f); fwrite(emp->name, sizeof(char), len, f); } Below is the work I have done so far that is required from the image but I have not been able to finish it and I need assistance with making the final changes that I have missed from the image that I have provided If you want to see the full code that this chunk of code is supposed to function with it is in the link below https://onlinegdb.com/nWSAIx8hCn
- Twist this assembly code, but this time a program asks the user to write anything and the written text/string must be saved in the file created in the this code.GIVEN CODE: .model small.stack 60h.data filepath db "UC",0filepath2 db "USC\USCMain",0filepath3 db "USC\USCTalamban",0filepath4 db "USC\USCSouth",0filepath5 db "USC\USCNorth",0;for uc banfilepath6 db "USC\USCSouth\BSECE ",0filepath7 db "USC\USCSouth\BSCPE",0create db "USC\USCSouth\BSCPE\Cruz.doc",0handle dw ?data db "My Name is Cruz, Juan"data_size=$-offset data .codemov ax,@datamov ds,ax mov ah,39hlea dx, filepathint 21h mov ah,39hlea dx, filepath2int 21h mov ah,39hlea dx, filepath3int 21h mov ah,39hlea dx, filepath4int 21h mov ah,39hlea dx, filepath5int 21h mov ah,39hlea dx, filepath6int 21h mov ah,39hlea dx, filepath7int 21h mov ah, 3chmov cx, 0mov dx, offset createmov ah, 3chint 21hmov handle, ax mov bx, handlemov dx, offset datamov cx, data_sizemov ah, 40hint 21h mov ah,4chint 21h endJava Program ASAP ************This program must work in hypergrade and pass all the test cases.********** I have provided the code instructions and the text files below. The test cases are located in Hypergrade. Down below is a working code. Dont add any import libraries in the program just modify the rest of the code so it passes the test cases. import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.HashMap;import java.util.Map;import java.util.Scanner;public class MorseCodeConverter { public static void main(String[] args) { Map<String, String> morseCodeMap = readMorseCodeTable("morse.txt"); Scanner scanner = new Scanner(System.in); System.out.print("Please enter the file name or type QUIT to exit:\n"); do{ String fileName = scanner.nextLine().trim(); if (fileName.equalsIgnoreCase("QUIT")) { break; } try { String…/* Filename: logserver.c *//*******************************************************************************************modify this program to log the message from clients to a log file. ******************************************************************************************/#include<stdio.h>#include<sys/ipc.h>#include<sys/shm.h>#include<sys/types.h>#include<string.h>#include<errno.h>#include<stdlib.h> #define BUF_SIZE 1024#define SHM_KEY 0x1234 struct shmseg {int cnt;int new;int complete;char buf[BUF_SIZE];}; int main(int argc, char *argv[]) {int shmid;struct shmseg *shmp;shmid = shmget(SHM_KEY, sizeof(struct shmseg), 0666|IPC_CREAT);if (shmid == -1) {perror("Shared memory");return 1;}// Attach to the segment to get a pointer to it.shmp = shmat(shmid, NULL, 0);if (shmp == (void *) -1) {perror("Shared memory attach");return 1;}/* Transfer blocks of data from shared memory to log file if the message from client set shmp->complete ==1, the we…
- THIS IS FOR C#. I need help fixing the code. Here is my code: using System;using System.Collections.Generic;using System.Globalization; class GreenvilleRevenue{static void Main(){int contestantsLastYear;int contestantsThisYear;string contestantName;string talentCode;List<string> talentCodes = new List<string>();List<string> contestantNames = new List<string>(); Console.Write("Enter number of contestants last year >> ");while (!int.TryParse(Console.ReadLine(), out contestantsLastYear)){Console.WriteLine("Invalid format - entry must be a number");Console.Write("Enter number of contestants last year >> ");} Console.Write("Enter number of contestants this year >> ");while (!int.TryParse(Console.ReadLine(), out contestantsThisYear)){Console.WriteLine("Invalid format - entry must be a number");Console.Write("Enter number of contestants this year >> ");} Console.WriteLine("Last year's competition had {0} contestants, and this year's has {1}…I'm not sure how to write a copy constructor that would construct a copy that would append rather than push, such that the result isn't backwards. Below is a provided main.h file for context purposes main.h: #pragma once #include <iostream> class Node { public: char letter; Node* down; Node(char c) : letter(c), down(nullptr) {} }; class Stack { private: Node* top_ = nullptr; public: Stack() = default; void push(char c); char top(); void pop(); bool isEmpty(); void clear(); friend std::ostream& operator<<(std::ostream& os, Stack const& s); ~Stack(); Stack& operator=(Stack other); Stack(Stack const& other); void Stack::append(char c); };Write a test client TestBinarySearch.java for use in testing the implementations of min(), max(), floor(), ceiling(), select(), rank(),deleteMin(), deleteMax(), and keys() that are given in the text. Start with the standard indexing client given on page 370. Add code to take additional command-line arguments, as appropriate.Write a test client TestBinarySearch.java for use in testing the implementations of min(), max(), floor(), ceiling(), select(), rank(),deleteMin(), deleteMax(), and keys() that are given in the text. Start with the standard indexing client given on page 370. Add code to take additional command-line arguments, as appropriate.Write a test client TestBinarySearch.java for use in testing the implementations of min(), max(), floor(), ceiling(), select(), rank(),deleteMin(), deleteMax(), and keys() that are given in the text. Start with the standard indexing client given on page 370. Add code to take additional command-line arguments, as appropriate.Write a test client…