Write the MIPS assembly code to find the area of a given shape. Your program must take a floating-point value and shape (Circle - 1, Triangle - 2, Square - 3) as input and return the circumference/perimeter and area of the shape. Assume the floating-point value units are meters and the triangle is an equilateral triangle. [Note: you can search for the expression to calculate the area and circumference/perimeter of these shapes]

Answers

Answer 1

Answer:

Explanation:

.data

msg1: .asciiz "Enter the floating point value = "

msg2: .asciiz "\nEnter the shape (Circle - 1, Triangle - 2, Square - 3) = "

msg3: .asciiz "\nThe perimeter of the triangle with side = "

msg4: .asciiz " meters is "

msg5: .asciiz " meters.\n"

msg6: .asciiz "\nThe area of the triangle with side = "

msg7: .asciiz " square meters.\n"

msg8: .asciiz "\nThe circumference of the circle with radius = "

msg9: .asciiz "\nThe area of the circle with radius = "

msg10: .asciiz "\nThe perimeter of the square with side = "

msg11: .asciiz "\nThe area of the square with side = "

pi: .float 3.1415816

eq_tr_area: .float 0.43305186

two: .float 2

three: .float 3

four: .float 4

.text

li $v0,4           # system call code for printing string = 4

la $a0,msg1       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

li $v0,6           # system call code for reading floating point number

syscall           # call operating system to perform read operation

li $v0,4           # system call code for printing string = 4

la $a0,msg2       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

li $v0,5           # system call code for reading integer

syscall           # call operating system to perform read operation

move $t0,$v0

IF:

bne $t0,1,ELSE_IF   #if not 1 then goto elseif

li $v0,4           # system call code for printing string = 4

la $a0,msg8       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f0       #move the single precision f2 in f12

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg4       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

l.s $f1,pi

l.s $f3,two

mul.s $f3,$f3,$f1   #calculate 2*pi*radius

mul.s $f3,$f3,$f0

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f3       #move the single precision f2 in f12

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg5       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg9       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f0       #move the single precision f2 in f12

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg4       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

mul.s $f2,$f0,$f0   #calculate radius *radius

mul.s $f2,$f2,$f1   #calculate pi *r^2

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f2       #move the single precision f2 in f12

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg7       # load address of string to be printed into $a0

syscall  

ELSE_IF:

bne $t0,2,ELSE       #if not 2 then check else

li $v0,4           # system call code for printing string = 4

la $a0,msg3       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f0       #move the single precision f2 in f12

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg4       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

l.s $f3,three

mul.s $f3,$f3,$f0   #calculate 3*side

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f3       #move the single precision f2 in f12

syscall           # call operating system to perform print operation

li $v0,4            

la $a0,msg5        

syscall            

li $v0,4            

la $a0,msg6        

syscall          

li $v0, 2        

mov.s $f12,$f0        

syscall            

li $v0,4            

la $a0,msg4      

syscall            

l.s $f3,eq_tr_area    

mul.s $f2,$f0,$f0    

mul.s $f2,$f2,$f3    

li $v0, 2      

mov.s $f12,$f2      

syscall            

li $v0,4            

la $a0,msg7        

syscall  

ELSE:

bne $t0,3,END        

li $v0,4            

la $a0,msg10        

syscall            

li $v0, 2        

mov.s $f12,$f0        

syscall            

li $v0,4            

la $a0,msg4        

syscall            

l.s $f3,four      

mul.s $f3,$f3,$f0    

li $v0, 2        

mov.s $f12,$f3      

syscall            

li $v0,4          

la $a0,msg5        

syscall            

li $v0,4          

la $a0,msg11      

syscall            

li $v0, 2        

mov.s $f12,$f0      

syscall            

li $v0,4          

la $a0,msg4        

syscall          

mul.s $f2,$f0,$f0    

li $v0, 2        

mov.s $f12,$f2      

syscall            

li $v0,4            

la $a0,msg7        

syscall  

END:

li $v0,10        

syscall          

Answer 2

Code is as follows:

.data

msg1: .asciiz "Enter the floating point value = "

msg2: .asciiz "\nEnter the shape (Circle - 1, Triangle - 2, Square - 3) = "

msg3: .asciiz "\nThe perimeter of the triangle with side = "

msg4: .asciiz " meters is "

msg5: .asciiz " meters.\n"

msg6: .asciiz "\nThe area of the triangle with side = "

msg7: .asciiz " square meters.\n"

msg8: .asciiz "\nThe circumference of the circle with radius = "

msg9: .asciiz "\nThe area of the circle with radius = "

msg10: .asciiz "\nThe perimeter of the square with side = "

msg11: .asciiz "\nThe area of the square with side = "

pi: .float 3.1415816

eq_tr_area: .float 0.43305186

two: .float 2

three: .float 3

four: .float 4

.text

li $v0,4           # system call code for printing string = 4

la $a0,msg1       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

li $v0,6           # system call code for reading floating point number syscall           # call operating system to perform read operation

li $v0,4           # system call code for printing string = 4 la $a0,msg2       # load address of string to be printed into $a0 syscall           # call operating system to perform print operation

li $v0,5           # system call code for reading integer syscall           # call operating system to perform read operation move $t0,$v0

IF:

bne $t0,1,ELSE_IF   #if not 1 then goto elseif

li $v0,4           # system call code for printing string = 4

la $a0,msg8       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

li $v0, 2       # system call code for printing float = 2 mov.s $f12,$f0       #move the single precision f2 in f12 syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4 la $a0,msg4       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

l.s $f1,pi l.s $f3,two

mul.s $f3,$f3,$f1   #calculate 2*pi*radius

mul.s $f3,$f3,$f0

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f3       #move the single precision f2 in f12

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg5       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg9       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f0       #move the single precision f2 in f12

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg4       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

mul.s $f2,$f0,$f0   #calculate radius *radius

mul.s $f2,$f2,$f1   #calculate pi *r^2

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f2       #move the single precision f2 in f12

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg7       # load address of string to be printed into $a0

syscall  

ELSE_IF:

bne $t0,2,ELSE       #if not 2 then check else

li $v0,4           # system call code for printing string = 4 la $a0,msg3       # load address of string to be printed into $a0 syscall           # call operating system to perform print operation

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f0       #move the single precision f2 in f12

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg4       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

l.s $f3,three

mul.s $f3,$f3,$f0   #calculate 3*side

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f3       #move the single precision f2 in f12

syscall  

bne $t0,3,END       #if not 3 then end

li $v0,4           # system call code for printing string = 4

la $a0,msg10       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f0       #move the single precision f0 in f12

syscall           # call operating system to perform print operation

li $v0,4           # system call code for printing string = 4

la $a0,msg4       # load address of string to be printed into $a0

syscall           # call operating system to perform print operation

l.s $f3,four       # multilply by 4

mul.s $f3,$f3,$f0   #calculate 4*side

li $v0, 2       # system call code for printing float = 2

mov.s $f12,$f3       #move the single precision f3 in f12

syscall           # call operating system to perform print operation

END:  

li $v0,10       # system call code for printing exit (end of program)

syscall           # call operating system to perform print operation

Learn More:https://brainly.com/question/10169933

Write The MIPS Assembly Code To Find The Area Of A Given Shape. Your Program Must Take A Floating-point
Write The MIPS Assembly Code To Find The Area Of A Given Shape. Your Program Must Take A Floating-point
Write The MIPS Assembly Code To Find The Area Of A Given Shape. Your Program Must Take A Floating-point
Write The MIPS Assembly Code To Find The Area Of A Given Shape. Your Program Must Take A Floating-point
Write The MIPS Assembly Code To Find The Area Of A Given Shape. Your Program Must Take A Floating-point

Related Questions

com to enjoy dont give fkin lecture hsb-tnug-fyt​

Answers

Answer:

This is my faverrrrate part of computer science lol.

Explanation:

Please Complete in Java a. Create a class named Book that has 5 fields variables: a stock number, author, title, price, and number of pages for a book. For each field variable create methods to get and set methods. b. Design an application that declares two Book objects. For each object set 2 field variables and print 2 field values. c. Design an application that declares an array of 10 Books. Prompt the user to set all field variables for each Book object in the array, and then print all the values.

Answers

Answer:

Explanation:

The following code is written in Java. I created both versions of the program that was described in the question. The outputs can be seen in the attached images below. Both versions are attached as txt files below as well.

NO LINKS OR SPAMS THEY WILL BE REPORTD

Click here for 50 points

Answers

Answer:

thanks for the point and have a great day

Can anybody please help me with 7.4.7 spelling bee codehs?

Answers

Answer:

word = "eggplant"

print "Your word is: " + word + "."

for i in word:

   print i + "!"

Explanation:

i don't know why but it is

Answer:

word = "eggplant"

print("Your word is !" + word + "!")

for i in word:

INDENT HERE or TAB print( i + "!")

Explanation:

Add an indentation right before the print( i + "!")

NEED HELP IMMEDIATELY!!
What is the difference between a worm and a typical virus?
A) Worms are a type of spyware; viruses are a type of malware.
B) Worms are impossible to remove; viruses can be tracked and removed.
C) Worms are stronger than viruses; viruses are stronger than spam.
D) Worms travel independently of human action; viruses require human actions.

Answers

Answer:

Option C

Explanation:

Option A is incorrect as Worm is a form of malware

Option B is incorrect because antivirus can remove all forms of malware

Option C is correct because a worm is more problematic as compared to the virus. Also, viruses are weaker than worm because they need a host file to run but a worm can work independently.

Option D is also incorrect because both are able to self replicate.

You own a small hardware store. You have been in business since 1995 and have always been profitable. You’ve never seen a need to do any marketing or advertising since you were able to stay profitable without those things. Plus, you lack any real understanding of how to use technology and it makes you anxious just thinking about technology or social media. However, your son just graduated from college and came home to live with you for the summer before he starts his new marketing manager job at a big firm. He tells you that you are probably losing a big share of the market by avoiding technology and social media. He also says that many of these items can be implemented very easily, and he would volunteer to continue to manage the social media sites in his spare time even after he starts his new job.

Answers

Answer:

Was this a TROLL?

Explanation:

Explain the difference between invention and innovation?

Answers

Invention is about creating something new, while innovation introduces the concept of use of an idea or method.

Programming errors can result in a number of different conditions. Choose all that apply.
The program will halt execution.
An error message will be displayed.
Incorrect results will occur.
Code will run faster.
the first 3

Answers

Answer:

The program will halt execution and and error message will be displayed. Probably number 3 too.

Answer:

A, B and C

Explanation:

Complete the sentence.
In your program, you can open

Answers

In your program, you can open a file using the open() function in Python.

What is the program about?

A high-level, all-purpose programming language is Python. Code readability is prioritized in its design philosophy, which makes heavy use of indentation. Python uses garbage collection and has dynamic typing.

It supports a variety of programming paradigms, such as functional, object-oriented, and structured programming. The open() function in Python allows you to open a file, read its contents, and perform various operations on it, such as writing, appending, etc.

Learn more about program on:

https://brainly.com/question/26642771

#SPJ1

You are installing a new graphics adapter in a Windows 10 system. Which of the following expansion slots is designed for high-speed, 3D graphics adapters?

A: USB
B: Firewire
C: PCI
D: PCIe

Answers

Answer:

pclex16

NIC

the graphic card must be high

How should you add a appointment to your outlook calendar

Answers

answer:

press on the date thing

Put a note on the date you have a appointment on in your calendar

Color, font, and images are all important aspects of good

I'll mark brainest​

Answers

Answer:

of good design, so its c ....

Answer: Design

Color, font, and images are all important aspects of good Design.

,  Hope this helps :)

Have a great day!!

Use at Least one hundred words to explain what you did the last time your handheld personal computer went slow.​

Answers

Answer:

Disk defragmentation

clear up storage

restart the computer

Explanation:

PC's going slow is a very common occurence nowadays and what i had to do to usually fix slow computers is to first use disk defragmentation which will automatically sort our files and put them in the right order.Second is to delete any unnessary files,folders,programs that i no longer use or its just sitting there eating dust and finally my last resort is to restart the pc which usually helps fix most of the issues including slow PCs which might be caused by some errors during startup.

Hope this helped

1
When determining the statement of purpose for a database design, what is the most important question to
Who will use the database?
O Should I use the Report Wizard?
How many copies should I print?
How many tables will be in the database?

Answers

Answer: A) Who will use the database?

Answer:

It's A

Explanation:

spreadsheet formula for total 91?​

Answers

Answer:

Go to any blank cell. Enter the number 91.

Select the cell that contains 91. Press Ctrl+C to copy.

Select your range the contains numbers.

Press Ctrl+Alt+V to open the Paste Special dialog.

In the top of the Paste Special dialog, choose Values. In the Operation section, choose Add. Click OK.

Explanation:

Find the sum of the values ​​from one to ten using recursion

Answers

Answer:

see picture

Explanation:

The result is 55, which can also be verified using the formula:

(n)(n-1)/2 => 10*9/2 = 55

In c please
Counting the character occurrences in a file
For this task you are asked to write a program that will open a file called “story.txt
and count the number of occurrences of each letter from the alphabet in this file.
At the end your program will output the following report:
Number of occurrences for the alphabets:
a was used-times.
b was used - times.
c was used - times .... ...and so, on
Assume the file contains only lower-case letters and for simplicity just a single
paragraph. Your program should keep a counter associated with each letter of the
alphabet (26 counters) [Hint: Use array|
| Your program should also print a histogram of characters count by adding
a new function print Histogram (int counters []). This function receives the
counters from the previous task and instead of printing the number of times each
character was used, prints a histogram of the counters. An example histogram for
three letters is shown below) [Hint: Use the extended asci character 254]:

Answers

Answer:

#include <stdio.h>

#include <ctype.h>

void printHistogram(int counters[]) {

   int largest = 0;

   int row,i;

   for (i = 0; i < 26; i++) {

       if (counters[i] > largest) {

           largest = counters[i];

       }

   }

   for (row = largest; row > 0; row--) {

       for (i = 0; i < 26; i++) {

           if (counters[i] >= row) {

               putchar(254);

           }

           else {

               putchar(32);

           }

           putchar(32);

       }

       putchar('\n');

   }

   for (i = 0; i < 26; i++) {

       putchar('a' + i);

       putchar(32);

   }

}

int main() {

   int counters[26] = { 0 };

   int i;

   char c;

   FILE* f;

   fopen_s(&f, "story.txt", "r");

   while (!feof(f)) {

       c = tolower(fgetc(f));

       if (c >= 'a' && c <= 'z') {

           counters[c-'a']++;

       }

   }

   for (i = 0; i < 26; i++) {

       printf("%c was used %d times.\n", 'a'+i, counters[i]);

   }

   printf("\nHere is a histogram:\n");

   printHistogram(counters);

}

Create a program which reads in CSV data of Creatures and loads them into aHash Map. The key of this hash map will be the name of each creature. For your hash function, you can simply use the sum of all ASCII values. You can also come up with your own hash function. Your program should present a menu to the user allowing them to look up a creature by name. Additionally, create a function that allows the user to insert a new creature. This creature should be added to the existing hash map. If the name entered by the user already exists, DO NOT ADD IT TO THE HASH MAP. Simply report that the creature already exists. If the creature is unique and successfully added, report the calculated index value. Your hash array should start as size4. You will need to implement a rehashing function to maintain a load factor of 0.75. Collision resolution should be handled via separate chaining with linked lists.
Other Requirements
•Read in a CSV file from the command line when running the program.
•Convert the raw CSV data into the creature struct and add it to a HashMap
•Make sure you properly release all of your allocated memory.
•Format your code consistently.
•Function declarations, structs, and preprocess directives should be placed in a corresponding header file.
•Save your code for this problem ascreature_hash.(c|h).
Creature struct
typedef struct {
char *name;
char *type;
int hp;
int ac;
int speed;
} Creature;
Example Run
1. Search

2. Add Creature

3. Exit

> 1

Enter name: Terrasque

Unable to find "Terrasque"

1. Search

2. Add Creature

3. Exit

> 2

Enter name: Storm Giant

Enter type: Huge giant

Enter HP: 230

Enter AC: 16

Enter speed: 50

Storm Giant added at index 3.

CSV file: Name, hp, ac, speed, type

Rakshasa,110,16,40,Fiend
Priest,27,13,25,Humanoid
Berserker,67,13,30,Humanoid
Fire Elemental,102,13,50,Elemental
Kraken,472,18,20,Monstrosity
Centaur,45,12,50,Monstrosity
Mage,40,12,30,Humanoid
Hell Hound,45,15,50,Fiend
Basilisk,52,15,20,Elemental
Androsphinx,199,17,40,Monstrosity
Efreeti,200,17,40,Elemental
Balor,262,19,40,Fiend
Chain Devil,142,19,40,Fiend
Adult Black Dragon,195,19,80,Dragon
Adult Blue Dragon,225,19,80,Dragon
Adult Red Dragon,256,19,80,Dragon
Please help in C

Answers

Answer:

Explanation:

class TableInput{

    Object key;

    Object value;

    TableInput(Object key, Object value){

       this.key = key;

       this.value = value;

   }

}

abstract class HashTable {

   protected TableInput[] tableInput;

   protected int size;

   HashTable (int size) {

       this.size = size;

       tableInput = new TableInput[size];

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

           tableInput[i] = null;

       }

   }

   abstract int hash(Object key);

   public abstract void insert(Object key, Object value);

   public abstract Object retrieve(Object key);

}

class ChainedTableInput extends TableInput {

   ChainedTableInput(Object key, Object value){

       super(key, value);

       this.next = null;

   }

    ChainedTableInput next;

}

class ChainedHashTable extends HashTable {

   ChainedHashTable(int size) {

       super(size);

       // TODO Auto-generated constructor stub

   }

   public int hash(Object key){

       return key.hashCode() % size;

   }

   public Object retrieve(Object key){

       ChainedTableInput p;

       p = (ChainedTableInput) tableInput[hash(key)];

       while(p != null && !p.key.equals(key)){

           p = p.next;

       }

       if (p != null){

           return p.value;

       }

       else {

           return null;

       }

   }

   public void insert(Object key, Object value){

       ChainedTableInput entry = new ChainedTableInput(key, value);

       int k = hash(key);

       ChainedTableInput p = (ChainedTableInput) tableInput[k];

       if (p == null){

           tableInput[k] = entry;

           return;

       }

       while(!p.key.equals(key) && p.next != null){

           p = p.next;

       }

       if (!p.key.equals(key)){

           p.next = entry;

       }

   }

   public double distance(Object key1, Object key2){

       final int R = 6373;

       Double lat1 = Double.parseDouble(Object);

   }

   }

1.Write a Java program to solve the following problem using modularity. Write a method that rotates a one-dimensional array with one position to the right in such a way that the last element becomes the first element. Your program will invoke methods to initialize the array (random values between 1 and 15) print the array before the rotation, rotate the array, and then print the array after rotation. Use dynamic arrays and ask the user for the array size. Write your program so that it will generate output similar to the sample output below:

Answers

Answer:

Explanation:

The following code is written in Java and it asks the user for the size of the array. Then it randomly populates the array and prints it. Next, it rotates all the elements to the right by 1 and prints the new rotated array.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Random;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Random r = new Random();

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Size of the Array: ");

       int arraySize = in.nextInt();

       ArrayList<Integer> myList = new ArrayList<>();

       for (int x = 0; x < arraySize; x++) {

           myList.add(r.nextInt(15));

       }

       System.out.println("List Before Rotation : " + Arrays.toString(myList.toArray()));

       for (int i = 0; i < 1; i++) {

           int temp = myList.get(myList.size()-1);

           for (int j = myList.size()-1; j > 0; j--) {

               myList.set(j, myList.get(j - 1));

           }

           myList.set(0, temp);

       }

       System.out.println("List After Rotation :  " + Arrays.toString(myList.toArray()));

   }

}


A suggestion for improving the user experience
for the app navigation, has the following
severity
Usability
Low
Critical
Medium
High

Answers

User experience is one of the most important things considered in the modern IT world. Almost 90% of the population is dependent on mobile phones, electronic devices.  So, one things that come is app development. Therefore, in order to enhance more growth in app development, there need to better user experience. We need to think about users and i don't Know More info.

Uhh... What is happening?.. What... Pt 2

Answers

Pistons being pistons I guess...

Answer:

Levers on the parts we cant see?

CS160 Computer Science I In class Lab 10
Objective:
Work with dictionaries
Work with strings
Work with files
Assignment:
This program will read a file of English words and their Spanish translation. It then asks the user for an English word. If it exists in your dictionary the Spanish translation is displayed. If the English word does not exist in the dictionary the program states that the word does not exist in its list of words.
Specifics:
Create a text file, with one English word and a Spanish word per line, separated by a colon. You can create the language file using a text editor, you do not need to write a program to create this file. An example of the file might be:
one:uno
two:dos
three:tres
four:cuatro
five:cinco
six:seis
seven:siete
eight:ocho
nine:nueve
ten:diez
After reading the text file, using it to fill up a dictionary, ask the user for an English word. If the word exists, print out the Spanish version. If the word does not exist state that the word is not in your list. Continue this process of asking for a word until the user does not enter a word (just pressed Enter).
As you might have noticed, there is nothing in the program that limits this Spanish words. This program can be written to work with any translation, so feel free to make it be French, or German or any other language where you can come up with a list of translated words. You also are not limited to 10 words, that is just the list I came up with for the example. The number of key/values pairs that you have in your dictionary is basically limited by the memory in your computer.
Hints
You will need to determine if the key (the English word) exists in the dictionary. Use the in operator with the dictionary, or the get() method. Either can be used to avoid crashing the program, which happens if you attempt to use a key that does not exist.
An example of running the program might be:
Enter the translation file name: oneToTen.txt
> Enter an English word to receive the Spanish translation.
Press ENTER to quit.
Enter an English word: one
he Spanish translation is uno
Enter an English word: ten
The Spanish word is diez
Enter an English word: 5
I don’t have that word in my list.
Enter an English word: three
The Spanish word is tres

Answers

Answer:

The program in Python is as follows:

fname = input("Enter the translation file name: ")

with open(fname) as file_in:

   lines = []

   for line in file_in:

       lines.append(line.rstrip('\n'))

myDict = {}

for i in range(len(lines)):

x = lines[i].split(":")

myDict[x[0].lower()] = x[1].lower()

print("Enter an English word to receive the Spanish translation.\nPress ENTER to quit.")

word = input("Enter an English word: ")

while(True):

if not word:

 break

if word.lower() in myDict:

 print("The Spanish word is ",myDict[word.lower()])

else:  

 print("I don’t have that word in my list.")

word = input("Enter an English word: ")

Explanation:

This prompts the user for file name

fname = input("Enter the translation file name: ")

This opens the file for read operation

with open(fname) as file_in:

This creates an empty list

   lines = []

This reads through the lines of the file

   for line in file_in:

This appends each line as an element of the list

       lines.append(line.rstrip('\n'))

This creates an empty dictionaty

myDict = {}

This iterates through the list

for i in range(len(lines)):

This splits each list element by :

x = lines[i].split(":")

This populates the dictionary with the list elements

myDict[x[0].lower()] = x[1].lower()

This prints an instruction on how to use the program

print("Enter an English word to receive the Spanish translation.\nPress ENTER to quit.")

This prompts the user for an English word

word = input("Enter an English word: ")

This loop is repeated until the user presses the ENTER key

while(True):

If user presses the ENTER key

if not word:

The loop is exited

 break

If otherwise, this checks if the word exists in the dictionary

if word.lower() in myDict:

If yes, this prints the Spanish translation

 print("The Spanish word is ",myDict[word.lower()])

If otherwise,

else:

Print word does not exist

 print("I don’t have that word in my list.")

Prompt the user for another word

word = input("Enter an English word: ")

The following procedure is intended to return the number of times the value val appears in the list nylist. The procedure does not work as intended, Line 1: PROCEDURE countNumoccurences (mylist, val) Line 2: Line 3: FOR EACH item IN mylist Line 4: Line 5: count = 0 Line 6: IF(item = val) Line 7: tine 8: count count + 1 tine 9: Line 10: Eine 11: RETURN (count) Line 12:) Which of the following changes can be made so that the procedure will work as intended?
A. Changing line 6 to IF(item = count)
B. Changing line 6 to IF(myList[item) - val)
C. Moving the statement in line 5 so that it appears between lines 2 and 3
D. Moving the statement in line 11 so that it appears between lines 9 and 10 ->

Answers

Answer:

C. Moving the statement in line 5 so that it appears between lines 2 and 3

Explanation:

Given

The attached procedure

Required

What should be modified

The problem in the procedure is on line 5

i.e. count = 0

This line is within the loop, and this means that the count variable is initialized to 0 each time the loop is repeated.

To solve this, the count variable has to be removed from the loop to somewhere before the loop.

Hence, option (c) is correct

Throughout our procedure, even though we proclaimed count = 0 inside the for loop, the count has been valued at 0.  

After that, When a certain value is found equal to Val, the count has been incremented by 1. The count is set to 0 again in the next iteration, so at the end, if we found an element equivalent to Val 1, its real count has been returned.To get around this, we'll define count outside of the for loop to acquire the true count of instances of that specific value.

Therefore, the answer is "Option C".

Learn more:

brainly.com/question/14941418

Operating Expenses for a business includes such things as rent, salaries, and employee benefits.

Answers

Overhead expenses are what it costs to run the business, including rent, insurance, and utilities. Operating expenses are required to run the business and cannot be avoided. Overhead expenses should be reviewed regularly in order to increase profitability. Overhead costs can include fixed monthly and annual expenses such as rent, salaries and insurance or variable costs such as advertising expenses that can vary month-on-month based on the level of business activity. Operating expenses are expenses a business incurs in order to keep it running, such as staff wages and office supplies. Operating expenses do not include cost of goods sold (materials, direct labor, manufacturing overhead) or capital expenditures (larger expenses such as buildings or machines). Hope this helps!

Answer:

TRUE

Explanation:

Write a function to calculate the distance between two points Distance( x1, y1,x2.2) For example Distance(0.0,3.0, 4.0.0.0) should return 5.0 Use the function in main to loop through reading in pairs of points until the all zeros are entered printing distance with two decimal precision for each pair of points.
For example with input
32 32 54 12
52 56 8 30
44 94 4439 6
5 19 51 91 7.5
89 34 0000
Your output would be:__________.
a. 29.73
b. 51.11
c. 55.00
d. 73.35
e. 92.66

Answers

Answer:

The function in Python3  is as follows

def Distance(x1, y1, x2, y2):

   dist = ((x1 - x2)**2 +(y1 - y2)**2)**0.5

   return dist

   

Explanation:

This defines the function

def Distance(x1, y1, x2, y2):

This calculates distance

   dist = ((x1 - x2)**2 +(y1 - y2)**2)**0.5

This returns the calculated distance to the main method

   return dist

The results of the inputs is:

[tex]32, 32, 54, 12 \to 29.73[/tex]

[tex]52,56,8,30 \to 51.11[/tex]

[tex]44,94,44,39\to 55.00[/tex]

[tex]19,51,91,7.5 \to 84.12[/tex]

[tex]89,34,00,00 \to 95.27[/tex]

Write a recursive method named factorial that accepts an integer n as a parameter and returns the factorial of n, or n!. A factorial of an integer is defined as the product of all integers from 1 through that integer inclusive. For example, the call of factorial(4) should return 1 * 2 * 3 * 4, or 24. The factorial of 0 and 1 are defined to be 1. You may assume that the value passed is non-negative and that its factorial can fit in the range of type int. Do not use loops or auxiliary data structures; solve the problem recursively.

Answers

Answer:

The function in Python is as follows:

def factorial(n):

  if n == 1 or n == 0:

      return n

  else:

      return n*factorial(n-1)

Explanation:

This defines the function

def factorial(n):

This represents the base case (0 or 1)

  if n == 1 or n == 0:

It returns 0 or 1, depending on the value of n

      return n

If n is positive, then this passes n - 1 to the factorial function. The process  is repeated until n = 1

  else:

      return n*factorial(n-1)

Requirements description:
Assume you work part-time at a Cafe. As the only employee who knows java programming, you help to write an ordering application for the store.
The following is a brief requirement description with some sample output.
1. Selecting Breakfast or Lunch(5 points)
When the program starts, it first shows option Breakfast or Lunch. A sample output is as follows.
=== Select Breakfast or Lunch: ===
1. Breakfast
2. Lunch
You are supposed to validate the input.
If the user enters a letter or a number not between 1 and 2, the user will see an error message.
A sample output for invalid number is as follows.
Select Breakfast or Lunch [1, 2]: 0
Error! Number must be greater than 0.
Select Breakfast or Lunch [1, 2]:
2. Selecting Coffee (20 points)
When the program continues, it shows a list/menu of coffee and their prices, then asks a user to select a coffee by entering an integer number. A sample output is as follows.
=== Select Coffee: ===
1 Espresso $3.50
2 Latte $3.50
3 Cappuccino $5.00
4 Cold Brew $3.00
5 Quit Coffee selection
Select a coffee [1, 5]:
You are supposed to validate the input.
If the user enters a letter or a number not between 1 and 5, the user will see an error message.
A sample output for invalid number is as follows.
Select a coffee [1, 5]: 0
Error! Number must be greater than 0.
Select a coffee [1, 5]:
In your program, you can hard-code the information for coffee (i.e., coffee names and prices) shown above, such as "1 Espresso $3.50" and use the hard-code price, such as 3.50, for calculation of a total price of the order.
After the user makes a choice for coffe, such as 2 for Latte. The program continues asking for selecting a coffee so that the user can have multiple coffee orders. The user can enter "5" to quit coffee selection. A sample output is as follows.
=== Select Coffee: ===
1 Espresso $3.50
2 Latte $3.50
3 Cappuccino $5.00
4 Cold Brew $3.00
5 Quit Coffee selection
Select Coffee: [1, 5]: 2
=== Select Coffee: ===
1 Espresso $3.50
2 Latte $3.50
3 Cappuccino $5.00
4 Cold Brew $3.00
5 Quit Coffee selection
Select Coffee: [1, 5]: 5
3. Selecting Food (10 points)
After Coffee selection, the program shows food selection. A sample output is as follows.
=== Select Food: ===
1 Tuna Sandwich $10.00
2 Chicken Sandwich $10.00
3 Burrito $12.00
4 Yogurt Bowl $8.00
5 Avocado Toast $8.00
6 Quit Food selection
Select Food: [1, 6]: 1
Input validation is needed and works as before. Like Coffee selection which allows selecting multiple Coffee orders, food selection also repeats after the user enters a valid number between 1 and 5.
You hard-code the information for food shown above, such as "1 Tuna Sandwich $10.00" and use the hard-code price, such as 10.00, for calculation of the total price of the order.

Answers

Answer:

The code has been written in Java.

The source code of the file has been attached to this response. The source code contains comments explaining important lines of the program.

A sample output got from a run of the application has also been attached.

To interact with the program, kindly copy the code into your Java IDE and save as Cafe.java and then run the program.

Grooved pavement ahead means

Answers

Answer:it means warning

Explanation:

( This isnt really a homework question, its more of just a general question ) I am starting to code C# and I have downloaded visual studio and dotnet, but when trying to run the code for opening a new console template it keeps giving me this error
" dotnet : The term 'dotnet' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1
+ dotnet new console
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (dotnet:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException "
Please help me fix this. ( btw i am using dotnet 6.0 SDK, but before that I was using 5.0.203

Answers

Answer:

Explanation:

This is usually an issue with the Microsoft Visual C++ redistributable. One fix that usually works is to do the following

Open Programs and Features

Uninstall and then choose Repair on Microsoft Visual C++ Redistributable (x86) and x64 version

Reinstall or repair the installation of the .NET Core SDK 1.0.1.

If this does not work, another option would be to manually change the install path of these files from "Program Files (x86) to  "Program Files"

Hope this helps solve your issue.

HTML tag that makes a text field used by javascript statement

Answers

I don’t even know I don’t even know I don’t even know
Other Questions
Please helpKari walked a total of 10 kilometers by making 5 trips to school. How many trips willKari have to make in all to walk a total of 16 kilometers? Assume the relationship isdirectly proportional. Similar TrianglesA triangle has two angles measuring 90 and 50, calculate the third angle of the triangle.a. 50b. 40c. 45d. 75Please select the best answer from the choices provided What is secession? Which state seceded first? What happened after the southern states seceded? Which kind of evidence studies mineralized bone, footprints, or organisms trapped in amber to determine common ancestry?fossilsanalogous structureshomologous structuresmolecular clock 100 POINTS!!!!!What is the strength of the association between the two variables in the scatter plot? Select from the drop-down menu to correctly complete the statement. weak strong Find value of x??????????? A boat travels 120 miles with the current down the river in less time than it takes to travel 80 miles against the current up the river. The boat makes the entire trip in 12 hours. The speed of the boat, without the current, remains constant at 20 miles per hour what is the speed of the current. What does the term "natural selection" mean?A. the gradual process by which something changes into a more desirable formB. the process by which small-scale changes take place in allele frequencies in a populationC. the process by which species adapt to their environment HELP!! 20 POINTSSIn 1862, Frederick Douglass wrote, "Negroes have repeatedly threaded their way through the lines of the rebels exposing themselves to bullets to convey important information to the loyal army of the Potomac."Source: Markle, Donald E. Spies and Spymasters of the Civil War. New York. Hippocrene Books, 1995; pp. 64 - 65.Which statement best summarizes Frederick Douglass' comments about African American spies?African American spies were often killed in the line of dutyAfrican American spies mainly worked on naval ships during the American Civil WarAfrican Americans were often refused to relay information to the Union armyAfrican Americans would put themselves in danger to relay information to the Union army. 16. What is the volume of the rectangular prism?*1 point5 in.s in3.4 in. Answer the questions in the picture. ONLY ANSWER IF YOU KNOW FRENCH!!! Will report bots. Two similar shapes have a pair of corresponding sides which are easily measurable.The smaller shape's side has a length of 4m, and the larger shape has a side length of5m. If the area of the smaller shape is 80m, what is the area of the larger shape? Here is the distribution of blood types from a groupof randomly selected people:BloodType:oBABProbability:0.490.270.200.04Joe can safely receive blood transformations frompeople with blood types O and B. What is theprobability that a randomly chosen person candonate blood to Joe? What is the value of x in the equation x = 3 4x + 6? 9 3 3 9 Corporation was organized on January 1, 2021. The firm was authorized to issue 100,000 shares of $5 par common stock. During 2021, QWN had the following transactions relating to shareholders' equity:Issued 10,400 shares of common stock at $5.80 per share.Issued 19,600 shares of common stock at $9.30 per share.Reported a net income of $106,000.Paid dividends of $53,000.Purchased 2,600 shares of treasury stock at $11.30 (part of the 19,600 shares issued at $9.30).Required:What is total shareholders' equity at the end of 2021? Who led the independence that caused the changes shown in this table Consumers must eat other organismsfor energy. Which organismsare consumers in this food chain? The dividend irrelevance theory, proposed by Miller and Modigliani, says that provided a firm pays at least some dividends, how much it pays does not affect either its cost of capital or its stock price.a) trueb) false The word "vegan" (,begin bold,vee,end bold, gun) can refer to a particular kind of diet or the person who follows that diet. Vegans typically do not consume animal products, so their diets avoid meat, fish, poultry, eggs, or dairy products. There are various reasons that people decide to become vegans; one reason is for the perceived health benefits of a vegan diet.Many experts say that a well-planned vegan diet is healthy, but vegans must choose their foods wisely. The animal and dairy products in a non-vegan diet provide important nutrients such as vitamin B12, calcium, and vitamin D. Vegans must find plant-based sources for these nutrients. For example, vegans can get vitamin B12 from fortified,superscript,1,baseline, breakfast cereals or foods made from soybeans. Many dark-green vegetables contain calcium; so do red beans and calcium-fortified fruit juices. Vegans can get vitamin D from fortified soy milk or rice milk. A healthy vegan diet includes a variety of fruits, vegetables, whole grains, nuts, seeds, and beans.People who want to switch to a vegan diet should start slowly. They should learn everything they can about being vegan and discuss their plan with a doctor or a dietician.,superscript,2,baseline, They should read food labels to see which foods contain animal products and look through a vegan cookbook. Then they might try a few popular vegan foods, such as veggie burgers. Many of the foods they ate before can remain part of a vegan diet. Vegans can still enjoy a crisp salad and a shiny, red apple!QuestionWhich pair of statements, best expresses two main ideas in the passage?1. Most people who become vegan make the switch because a vegan diet is healthier than other diets. Vegans can get all essential nutrients by including a variety of vegetables and fruits in their daily diet.2. The term "vegan" refers to people whose diets do not include meat, fish, poultry, eggs, or dairy products. People should not switch to a vegan diet without first learning how to prepare vegan foods.3. A vegan diet may lack nutrients such as vitamin B12, calcium, and vitamin D that meat-based diets provide. People who become vegan discover that their new diet includes many of the same foods they ate before.4. Vegans must make sure that their diets include a balance of proper nutrients from plant-based sources. People who want to become vegan should educate themselves about the diet and make gradual changes. I needd help pleaseeeee