As you are going to learn, the concept of type is a very important part of many programming
languages. Variables are also an important part, and must be declared with a specific type in
Java. A variable can be thought of as a box, and the type of a variable can be thought of a label
on the box — making sure that it can only hold contents of that particular type.
In Java, there are eight primitive types to choose from — byte, char, short, int, long, float,
double, and boolean. int, for instance, can hold whole numbers like 42, 1000, or 5679. Another
type, double, can hold floating point numbers like 3.14, 2.72, or 1.414. The type String is a little
different, and you will learn this later on in the course. All you need to know now, though, is
that a variable of type String can be use to hold text in double quotes, such as “Hello, world!”
or “CS18000”. Your job below, is to implement a program to prompt a student for some
information, then display it in a business card format. Doing so will introduce you to the types
int, double, and String.
Write a program that prompts a student, using Scanner, for their name (a String), age (an int),
GPA (a double), major (a String), and email (a String).
The information should then be displayed in the business card format shown on the example
output, which is located on the next page.
Page 1 of 2 — Problem-Solving and Object-Oriented Programming (CS 180)
Problem Solving And Object-Oriented Programming
You are required to create one class with a main() method, BusinessCard, that follows the specifications
outlined above. It is to be held in a file called BusinessCard.java. Keep in mind that only your last
submission will be considered.
– BusinessCard class — 100 points total
– 10 points each (5 total)
– Prompts the user for their name (a String)
– Prompts the user for their age (an int)
– Prompts the user for their GPA (a double)
– Prompts the user for their major (a String)
– Prompts the user for their email (a String)
– 50 points for the correct business card format
Page 2 of 2 — Problem-Solving and Object-Oriented Programming (CS 180)