1. The US Constitution establishes that only a natural born citizen who is at least thirty-five years of age is eligible to be President of the US (Article 2/section 1). Create a Java program to help a user determine if s/he is eligible to be President. (Use Dialog boxes for input/output).

Answers

Answer 1

Answer:

import javax.swing.JOptionPane;

public class PresidentEligibility {

 public static void main(String[] args) {

   

   String ageInput = JOptionPane.showInputDialog("Please enter your age:");

   int age = Integer.parseInt(ageInput);

   

   String citizenshipInput = JOptionPane.showInputDialog("Please enter your citizenship status:");

   String citizenship = citizenshipInput.toLowerCase();

   

   if(age >= 35 && citizenship.equals("natural born citizen")) {

     JOptionPane.showMessageDialog(null, "You are eligible to be President!");

   } else {

     JOptionPane.showMessageDialog(null, "Sorry, you are not eligible to be President.");

   }

 }

}


Related Questions

Making sure that every employee has a stake in customer happiness is the best way to ensure:
A) Lower marketing research costsB) Lower employee turnoverC) That you are creating a customer-centric corporate cultureD) A higher percentage of market share

Answers

Answer: C) That you are creating a customer-centric corporate culture

That you are creating a customer-centric corporate culture is the best way to ensure customer happieness.

What is Corporate culture?

Corporate culture is the set of values and practices that guide how management and employees should work together and interact inside an organization.

It may have an impact on staff recruitment and retention, productivity, financial success, and long-term viability of the organization. International trade, economic trends, national cultures and traditions, company size, and goods all have an impact on corporate culture.

A company's corporate culture embodies its guiding principles in both theory and practice. Clan culture, adhocracy culture, market culture, and hierarchical culture are the four different forms of business cultures.

Therefore, That you are creating a customer-centric corporate culture is the best way to ensure customer happieness.

To learn more about Customer centric corporate, refer to the link:

https://brainly.com/question/14030342?

#SPJ2

he files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly.

An example of the program is shown below:

Enter a number between 1 and 20 >> 5
5 4 3 2 1 Blastoff!
JAVA CODE:
// Prompt user for value to start
// Value must be between 1 and 20 inclusive
// At command line, count down to blastoff
// With a brief pause between each displayed value
import java.util.Scanner;
public class DebugSix3
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int userNum, val;
final int MIN = 1;
final int MAX = 20;
final int TIME_WASTER = 100000;
System.out.print("Enter a number between " + MIN +
" and " + MAX + " >> ");
userNum = keyboard.nextInt();
while(userNum < MIN && userNum < MAX)
{
System.out.println("Number out of range");
System.out.print("Enter a number between " + MIN + " and " +
MAX + " inclusive >> ");
userNum = keyboard.nextInt();
}
for(val = userNum; val == 0; --val)
{
System.out.print(val + " ");
for(int x = 0; x < TIME_WASTER; ++x)
for(int y = 0; y < TIMEWASTER; ++y)
for(int z = 0; z < TIME_WASTER;);
// Adjust these numbers for faster or slower performance
}
System.out.println("Blastoff!");
}
}

Answers

Fixed code:

import java.util.Scanner;

public class DebugSix3 {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int userNum, val;
final int MIN = 1;
final int MAX = 20;
final int TIME_WASTER = 100000;

Kotlin:
System.out.print("Enter a number between " + MIN + " and " + MAX + " >> ");
userNum = keyboard.nextInt();

while (userNum < MIN || userNum > MAX) {
System.out.println("Number out of range");
System.out.print("Enter a number between " + MIN + " and " + MAX + " inclusive >> ");
userNum = keyboard.nextInt();
}

for (val = userNum; val >= 0; --val) {
System.out.print(val + " ");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println("Blastoff!");
}

Changes made:

Fixed the while loop condition to use OR instead of AND
Fixed the for loop condition to use greater than or equal to instead of equal to
Added a try-catch block to pause the loop for 1 second using Thread.sleep() instead of nested for loops
Fixed some syntax errors and indentation issues.

program to take the command line input to cut down the blast off.

// DebugSix3.java

// Prompt user for value to start

// Value must be between 1 and 20 inclusive

// At command line, count down to blastoff

// With a brief pause between each displayed value

import javax.swing.*;

public class DebugSix3

{

 public static void main(String[] args)

 {

   String userNumString;

   int userNum, val;

   final int MIN = 1;

   final int MAX = 20;

   userNumString = JOptionPane.showInputDialog(null,

       "Enter a number between " + MIN + " and " + MAX + " inclusive");

   userNum = Integer.parseInt(userNumString);

   while(userNum < MIN || userNum > MAX)

   {

      userNumString = JOptionPane.showInputDialog(null,

       "Number out of range" +

       "\nEnter a number between " + MIN + " and " + MAX + " inclusive");

      userNum = Integer.parseInt(userNumString);

   }

   for(val = userNum; val > 0; --val)

   {

     System.out.print(val + "  ");

     for(int x = 0; x < 100000; ++x)

      for(int y = 0; y < 10000; ++y);

      // Adjust these numbers for faster or slower performance

   }

   System.out.println("Blastoff!");

 }

}

learn more about command line input here:

https://brainly.com/question/19569210

#SPJ1

Write code in MinutesToHours that assigns totalHours with totalMins divided by 60

Given the following code:

Function MinutesToHours(float totalMins) returns float totalHours
totalHours = MinutesToHours(totalMins / 60)
// Calculate totalHours:
totalHours = 0

Function Main() returns nothing
float userMins
float totalHours

userMins = Get next input
totalHours = MinutesToHours(userMins)

Put userMins to output
Put " minutes are " to output
Put totalHours to output
Put " hours." to output

Answers

Answer:

Function MinutesToHours(float totalMins) returns float totalHours

   // Calculate totalHours:

   totalHours = totalMins / 60

   return totalHours

End Function

Select the correct answer.
Which statement best describes a website builder?
A. an application that enables code editing to create a unique website
B.
a tool that enables developers to create web apps without programming knowledge
C.
a tool that enables developers to create websites without programming knowledge
D. an application that automatically applies HTML tags to text

Answers

The statement that best describes a website builder is option C. a tool that enables developers to create websites without programming knowledge

What is programming?

A website builder is a software tool that allows individuals or organizations to create websites without the need for advanced technical skills or knowledge of programming languages.

Website builders are designed to simplify the website creation process by providing an intuitive drag-and-drop interface and pre-designed templates that users can customize with their own content.

Therefore, With a website builder, users can create and edit web pages, add images and videos, and customize the design and layout of their website without needing to write code.

Read more about programming here:

https://brainly.com/question/23275071

#SPJ1

Other Questions
suppose the government increases the number of weeks an unemployed worker can collect unemployment insurance payments. all else being equal, we would expect unemployment to . suppose that we observe a decrease in wages. which graph most accurately shows how this would affect the aggregate demand - aggregate supply model? a researcher is doing a study on champagne consumption. she has defined three different income groups and has assigned interviewers a specific number of interviews with respondents in each group. this is an example of the chance of getting a rare disease is .03 per person. out of 1,000 people, how many of them are expected to get the disease? a cost benefit analysis balances the cost of an action against what Please help I give 55 pt. (9a) 1. which step in the stp process develops descriptions of the different segments, which helps firms better understand the customer profiles in each segment? 3. The purpose of the initiative, referendum, and recallwas toA) eliminate the two-party systemB) limit participation in state electionsC) increase citizen influence in governmentD) strengthen the power of political machines liquids are anisotropic because their properties are independent of the axis of testing. true or false In PQR, PQ= 5.4, QR= 3.6, and PR=6.2. To the nearest Tenth, what is MR why are two-component regulatory systems particularly useful for controlling gene expression in response to environmental signals? if the un convention on the prevention and punishment of the crime of genocide had existed during the nineteenth century, how might it have been applied to the actions of the eel river rangers? explain, citing from the chapter by brendan lindsay to support your answer. which individuals might have been prosecuted under the convention, and why? how might individual members of the eel river rangers have attempted to argue that their actions were not prosecutable under the convention? looking back at our other readings from part ii (aside from the lindsay chapter), what other information do you see that relates directly to the un convention on the prevention and punishment of the crime of genocide? cite from at least one reading (other than lindsay), and explain how it relates to one or more specific articles of the convention. which statement is part of the cell theory? responses cells are independent structures. , cells are independent structures., , , all cells are the same. all cells are the same. all cells are produced from other cells. all cells are produced from other cells. cells are able to make new organisms. cells are able to make new organisms., which of the following argues that leaders assume that people are inclined to embrace change when they are respected as individuals with intrinsic worth, agency, and capability? top-down change deficit-based change emergent approach abundance-based change appreciative mindset a segment that a company wants to appeal to with its products and marketing activities toward are known as a market the outcome of the gram stain is based on differences in the bacterial cell's multiple choice ribosomes. cell wall. flagella. inclusions. cell membrane. what are three positive qualities required for a healthy relationship? upon responding to the client's call bell, the nurse discovers the client's wound has dehisced. initial nursing management includes calling the health care provider and: what is the average allowance for each student?$7,$12,$8.50,$10,$7,$8,$10.50,$11 Write a essay on conservation measures the need for conservation