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
lubasha [3.4K]
3 years ago
14

This was a quiz that I submitted earlier in the semester but I had not received full points due to a coding mistake. Below, I wi

ll provide the instructions and the code that needs to be changed in order for the program to work. Any place that has a "// Student Code Here" or "// Test Your Methods Here" must be changed accordingly.------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------INSTRUCTIONS:Step 1Fill in the doubleOrNothing method, which takes an int as a parameter. If the number is less than 100, return that number doubled. Otherwise, return zero.For example, passing 4 to this method would return 8, but passing 104 to this method would return 0.Step 2Fill in the formatPercentmethod, which takes a double as a parameter that represents a percent value between 0 and 1. This method returns a String that is the percentage between 0 and 100 percent, with one place following the decimal before a '%'.For example, passing the double '.85' would return the string "85.0%".Step 3Fill in the everyOtherChar method, which takes a String parameter called word*. This method returns an int which computes the sum of the ASCII values of *every other* character in the parameter word, starting with the first character.For example, passing the word "yam" into the method would tally the ASCII value of the characters 'y' and 'm', which have ASCII values of 121 and 109 respectively, so the method would return 230.Test Your MethodsTest your methods by calling them within main. You may run your program in Develop mode as many times as you would like, but you may only submit your program once.------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------CODE:public class quiz1 { // Step 1 public static int doubleOrNothing(int num) {e // student code here } // Step 2 public static String formatPercent(double percent) { // student code here } // Step 3 public static int everyOtherChar(String word) { // student code here } public static void main(String [] args) { // test your methods here! }}
Computers and Technology
1 answer:
Naddik [55]3 years ago
5 0

Answer:

<em>The methods is completed as follows</em>

<em>See attachment for .java source file</em>

<em>Comments are used to explain difficult lines</em>

<em>Program starts here</em>

<em></em>

import java.util.*;

public class quiz1

{

public static int doubleOrNothing(int num)

{

 if(num<100)

 {

  num*=2;

 }

 else{

  num = 0;

 }

 System.out.println(num);

 return num;

}

public static String formatPercent(double percent)

{

 percent*=100;

 System.out.println(percent+"%");

 return percent+"%";

}

 

public static int everyOtherChar(String word)

{

 char first = word.charAt(0);

 char last = word.charAt(word.length() - 1);

 int ascii = (int)first + (int)last;

 System.out.print(ascii);

 return ascii;

}

public static void main(String [] args)

{

 //Testing doubleOrNothing method

 int num;

 Scanner input = new Scanner(System.in);

 System.out.print("Enter any integer number: ");

 num = input.nextInt();

 System.out.print("Result of doubleOrNothing method\n:");

 doubleOrNothing(num);

 

 //Testing formatPercent method

 double percent;

 System.out.print("Enter any number between 0 and 1: ");

 percent = input.nextDouble();

 System.out.print("Result of formatPercent method\n:");

 formatPercent(percent);

 

 //Testing everyOtherChar method

 String word;

 System.out.print("Enter any string: ");

 word = input.next();

 System.out.print("Result of everyOtherChar method\n:");

 everyOtherChar(word);

}

}

//See Attached file

Download java
You might be interested in
Front and rear camber and toe settings are being adjusted during a four-wheel alignment. The correct order for performing these
NNADVOKAT [17]

On a solid rear axle vehicle, this requires a thrust angle alignment that allows the technician to confirm that all four wheels are "square" with each other. Thrust angle alignments also identify vehicles that would "dog track" going down the road with the rear end offset from the front. If the thrust angle isn't zero on many solid rear axle vehicles, a trip to a frame straightening shop is required to return the rear axle to its original location.

On all vehicles with four-wheel independent suspensions, or front-wheel drive vehicles with adjustable rear suspensions, the appropriate alignment is a four-wheel alignment. This procedure "squares" the vehicle like a thrust angle alignment, and also includes measuring and adjusting the rear axle angles as well as the front.

Not all vehicles are easily adjustable or fully adjustable. Some vehicles require aftermarket kits to allow sufficient adjustment to compensate for accident damage or the change in alignment due to the installation of lowering springs.

When aligning a vehicle, it's appropriate for the vehicle to be carrying its "typical" load. This is important for drivers who continuously carry loads in their vehicles, such as sales representatives with samples or literature in the trunk. Additionally, when a vehicle is used for autocross or track events, some racers will sit in their car, or have the alignment shop "ballast" their vehicle to include the influence of the driver's weight on the suspension angles.

The primary static suspension angles that need to be measured and adjusted are caster, camber, toe and thrust angle. Here's a definition of each angle and its influence on a vehicle and its tires.

<span>
</span>

4 0
3 years ago
Write a SELECT statement that returns two columns: vendor_id and the largest unpaid invoice for each vendor. To do this, you can
Dafna1 [17]

Answer:

1. SELECT VendorID, MAX(InvoiceTotal) AS InvoiceMax

     FROM Invoices

     WHERE InvoiceTotal - CreditTotal - PaymentTotal > 0

     GROUP BY VendorID

2. SELECT SUM(InvoiceMax) AS SumOfMaximums

FROM (SELECT VendorID, MAX(InvoiceTotal) AS InvoiceMax

     FROM Invoices

     WHERE InvoiceTotal - CreditTotal - PaymentTotal > 0

     GROUP BY VendorID) AS MaxInvoice

5 0
4 years ago
Describe 6 difference of the types of computer<br>​
Trava [24]

Answer:

<h3>1. Supercomputer</h3>

One of types of computers is supercomputer. It is a computer that is at the front-line of current processing capacity, particularly speed of calculation. It is usually used to do tasks involving intense numerical calculations such as weather forecasting, fluid dynamics, nuclear simulations, theoretical astrophysics, and complex scientific computations

<h3>2. Mainframe Computer</h3>

Another computer type is mainframe computer. It is a computer that is capable of handling and processing very large amounts of data quickly. Its calculation speed can reach millions to tens of millions instructions per second (MIPS) and it can respond to hundreds of millions of users at a time.

This computer type is mainly used in large institutions such as government, banks and large corporations.

<h3>3. Minicomputer (Mid-Range Computer)</h3>

Minicomputers are a class of multi-user computers that lie in the middle range of the computing spectrum, in between the smallest mainframe computers and the largest single-user systems (microcomputers or personal computers).

Minicomputers are usually small in scale, simple in structure, easy to maintain, and low in cost. Therefore, they are often used in universities, scientific research institutions and industrial control fields.

<h3>4. Microcomputer (Personal Computer)</h3>

The term “microcomputer” was introduced with the advent of systems based on single chip microprocessors. In the early days, the microcomputers would still have been too expensive to be owned by a single individual. But in the late 20th century, microcomputers became the most common type of computer.

Therefore, the term "microcomputer" has practically become an anachronism and has been replaced the term "personal computer (PC)".

Personal computer has developed rapidly because of its small size, convenient use, low production cost, and low price. PC computing speed can reach hundreds of thousands to millions instructions per second, which can meet the requirements of data processing and scientific computing in production, scientific research, and life.

<h3>5. Workstation Computer</h3>

A workstation computer is a high-end personal computer between microcomputers and minicomputers. It is usually equipped with large-capacity memory, external storage, and large-screen displays. Therefore, it has strong data processing capabilities and graphics processing capabilities.

Workstation computers are designed and developed mainly for professional application fields like engineering design, animation production, scientific research, software development, financial management, information services, analog simulation, etc.

<h3>6. Server Computer</h3>

A server refers to a high-performance computer that provides shared information resources and various services for many users on the network at the same time in a network environment.

A server is expected to be capable of high-speed computing, long-term reliable operation (it features error-correction of RAM; redundant cooling; self-monitoring, RAID), and powerful external data throughput.

The structure of the server is similar to that of an ordinary computer. Many smaller servers are actually personal computers that have been dedicated to provide services for other computers. But they are very different in terms of processing power, stability, reliability, security, scalability, and manageability.

According to the services provided, server computers can be subdivided into database server, file server, Web server, FTP server, etc.

<h2>hope helpful <3</h2>
4 0
3 years ago
Write a program that uses two input statements to get two words as input. Then, print the words on one line separated by a space
Shkiper50 [21]

word1 = input("Enter a word: ")

word2 = input("Enter a word: ")

print(word1 + " " + word2)

I hope this helps!

6 0
3 years ago
A computer scientist creates a necklace to celebrate the birth of her daughter. The necklace encodes her daughter's
Vesna [10]

Answer:

26

Explanation:

I just know it ok; rjkhshwnwjk

5 0
4 years ago
Other questions:
  • Sam wants to move across the text in his documents to add data at predefined stops. Which key will he use to navigate through th
    13·2 answers
  • Suppose the length of each packet is L bits. Also, assume the path from a server to a client includes N links each of rate R (i.
    8·1 answer
  • __________bits equal one byte.EightTenSixty-fourThirty-twoSix
    10·1 answer
  • HELP
    13·1 answer
  • Retype the statements, correcting the syntax errors.
    8·1 answer
  • In the MARS Marketing Management Simulation, the results of your marketing mix decisions:
    9·1 answer
  • What happens if you try to compile and run this program?
    5·1 answer
  • Have you ever tried to learn a new language or do you have friends who've had that experience? What are some of the steps you wo
    10·2 answers
  • Solving Systems of Equations by Substitution <br> pdf
    11·1 answer
  • What is the output?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!